MCPcopy Index your code
hub / github.com/saltstack/salt / _cmd_str

Method _cmd_str

salt/client/ssh/shell.py:263–289  ·  view source on GitHub ↗

Return the cmd string to execute

(self, cmd, ssh=SSH_PATH)

Source from the content-addressed store, hash-verified

261 return stdout, stderr, retcode
262
263 def _cmd_str(self, cmd, ssh=SSH_PATH):
264 """
265 Return the cmd string to execute
266 """
267
268 # TODO: if tty, then our SSH_SHIM cannot be supplied from STDIN Will
269 # need to deliver the SHIM to the remote host and execute it there
270
271 command = [ssh]
272 if ssh != SCP_PATH:
273 command.append(self.host)
274 if self.tty and ssh == SSH_PATH:
275 command.append("-t -t")
276 if self.passwd or self.priv:
277 command.append(self.priv and self._key_opts() or self._passwd_opts())
278 if ssh != SCP_PATH and self.remote_port_forwards:
279 command.append(
280 " ".join(
281 [f"-R {item}" for item in self.remote_port_forwards.split(",")]
282 )
283 )
284 if self.ssh_options:
285 command.append(self._ssh_opts())
286
287 command.append(cmd)
288
289 return " ".join(command)
290
291 def _run_nb_cmd(self, cmd):
292 """

Callers 7

exec_nb_cmdMethod · 0.95
exec_cmdMethod · 0.95
sendMethod · 0.95
test_single_optsFunction · 0.45

Calls 4

_key_optsMethod · 0.95
_passwd_optsMethod · 0.95
_ssh_optsMethod · 0.95
appendMethod · 0.45