salt-ssh
#
salt-ssh
CLI factory.
- class saltfactories.cli.ssh.SaltSsh(*, config, config_dir=_Nothing.NOTHING, python_executable=None, system_service=False, cwd=_Nothing.NOTHING, environ=_Nothing.NOTHING, slow_stop=True, system_encoding=_Nothing.NOTHING, timeout=_Nothing.NOTHING, script_name, base_script_args=_Nothing.NOTHING, hard_crash=False, merge_json_output=True, roster_file=None, client_key=None, target_host=None, ssh_user=None)[source]#
Bases:
SaltCli
salt CLI factory.
- Parameters:
- 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.
- 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:
- run(*args, env=None, _timeout=None, **kwargs)#
Run the given command synchronously.
- Keyword Arguments:
- args:
The list of arguments to pass to
cmdline()
to construct the command to run- env:
Pass a dictionary of environment key, value pairs to inject into the subprocess.
- _timeout:
The timeout value for this particular
run()
call. If this value is notNone
, it will be used instead oftimeout
, the default timeout.
- Parameters:
args (str) –
env (EnvironDict | None) –
kwargs (Any) –
- Return type:
- terminate()#
Terminate the started subprocess.
- Return type: