MCPcopy
hub / github.com/saltstack/salt / run_ssh

Method run_ssh

tests/support/case.py:90–134  ·  view source on GitHub ↗

Execute salt-ssh

(
        self,
        arg_str,
        with_retcode=False,
        catch_stderr=False,
        timeout=None,
        wipe=False,
        raw=False,
        roster_file=None,
        ssh_opts="",
        log_level="error",
        config_dir=None,
        **kwargs,
    )

Source from the content-addressed store, hash-verified

88 )
89
90 def run_ssh(
91 self,
92 arg_str,
93 with_retcode=False,
94 catch_stderr=False,
95 timeout=None,
96 wipe=False,
97 raw=False,
98 roster_file=None,
99 ssh_opts="",
100 log_level="error",
101 config_dir=None,
102 **kwargs,
103 ):
104 """
105 Execute salt-ssh
106 """
107 if timeout is None:
108 timeout = self.RUN_TIMEOUT
109 if not roster_file:
110 roster_file = os.path.join(RUNTIME_VARS.TMP_CONF_DIR, "roster")
111 arg_str = (
112 "{wipe} {raw} -l {log_level} --ignore-host-keys --priv {client_key}"
113 " --roster-file {roster_file} {ssh_opts} localhost {arg_str} --out=json"
114 ).format(
115 wipe=" -W" if wipe else "",
116 raw=" -r" if raw else "",
117 log_level=log_level,
118 client_key=os.path.join(RUNTIME_VARS.TMP_SSH_CONF_DIR, "client_key"),
119 roster_file=roster_file,
120 ssh_opts=ssh_opts,
121 arg_str=arg_str,
122 )
123 ret = self.run_script(
124 "salt-ssh",
125 arg_str,
126 with_retcode=with_retcode,
127 catch_stderr=catch_stderr,
128 raw=True,
129 timeout=timeout,
130 config_dir=config_dir,
131 **kwargs,
132 )
133 log.debug("Result of run_ssh for command '%s %s': %s", arg_str, kwargs, ret)
134 return ret
135
136 def run_run(
137 self,

Callers 1

run_functionMethod · 0.80

Calls 3

run_scriptMethod · 0.95
formatMethod · 0.80
debugMethod · 0.80

Tested by

no test coverage detected