salt
¶
salt
CLI factory
- class saltfactories.cli.salt.Salt(*, 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
salt CLI factory
- Return type
None
- cmdline(*args, minion_tgt=None, **kwargs)[source]¶
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
- process_output(stdout, stderr, cmdline=None)[source]¶
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
- get_base_script_args()¶
Returns any additional arguments to pass to the CLI script
- 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.
- run(*args, _timeout=None, **kwargs)¶
Run the given command synchronously
- terminate()¶
Terminate the started daemon