spm

spm CLI factory

class saltfactories.cli.spm.Spm(*, config, python_executable=None, system_install=False, cwd=None, environ=None, script_name, base_script_args=NOTHING, slow_stop=True, timeout=NOTHING, hard_crash=False, merge_json_output=True)[source]

Bases: saltfactories.bases.SaltCli

spm CLI factory

Return type

None

cmdline(*args, minion_tgt=None, merge_json_output=None, **kwargs)

Construct a list of arguments to use when starting the subprocess

Parameters
  • args (str) – Additional arguments to use when starting the subprocess

  • minion_tgt (str) – The minion ID to target

  • merge_json_output (bool) – The default behavior of salt outputters is to print one line per minion return, which makes parsing the whole output as JSON impossible when targeting multiple minions. If this value is True, an attempt is made to merge each JSON line into a single dictionary.

  • kwargs – Additional keyword arguments will be converted into key=value pairs to be consumed by the salt CLI’s

get_base_script_args()

Returns any additional arguments to pass to the CLI script

get_display_name()

Returns a human readable name for the factory

get_script_args()

Returns any additional arguments to pass to the CLI script

get_script_path()

Returns the path to the script to run

is_running()

Returns true if the sub-process is alive

property pid

The pid of the running process. None if not running.

process_output(stdout, stderr, cmdline=None)

Process the output. When possible JSON is loaded from the output.

Returns

Returns a tuple in the form of (stdout, stderr, loaded_json)

Return type

tuple

run(*args, _timeout=None, **kwargs)

Run the given command synchronously

Parameters
  • args (list,tuple) – The list of arguments to pass to cmdline() to construct the command to run

  • _timeout (int) – The timeout value for this particular run() call. If this value is not None, it will be used instead of timeout, the default timeout.

terminate()

Terminate the started daemon