qtoolkit.host.base module#

class qtoolkit.host.base.BaseHost(config: HostConfig | None = None)[source]#

Bases: QTKObject

Base Host class.

abstract execute(command: str | list[str], workdir: str | Path | None = None)[source]#

Execute the given command on the host

Parameters:
  • command (str or list of str) – Command to execute, as a str or list of str

  • workdir (str or None) – path where the command will be executed.

  • stdin (None, PIPE or file-like) – Standard input, /dev/null if None

  • stdout (None, PIPE or file-like) – Standard output, /dev/null if None

  • stderr (None, PIPE, DEVNULL or file-like) – Standard error, same as stdout if None

Returns:

Local process object associated to the connection, if dryrun is False, else None

Return type:

subprocess.Popen object or None

abstract mkdir(directory, recursive: bool = True, exist_ok: bool = True) bool[source]#

Create directory on the host.

abstract write_text_file(filepath, content)[source]#

Write content to a file on the host.

class qtoolkit.host.base.HostConfig(root_dir: 'str | Path')[source]#

Bases: QTKObject

root_dir: str | Path#