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

Method send

salt/client/ssh/shell.py:354–382  ·  view source on GitHub ↗

scp a file or files to a remote system

(self, local, remote, makedirs=False)

Source from the content-addressed store, hash-verified

352 return ret
353
354 def send(self, local, remote, makedirs=False):
355 """
356 scp a file or files to a remote system
357 """
358 if makedirs:
359 pardir = os.path.dirname(remote)
360 if not pardir:
361 log.warning(
362 "Makedirs called on relative filename: '%s'. Skipping.", remote
363 )
364 else:
365 ret = self.exec_cmd("mkdir -p " + shlex.quote(pardir))
366 if ret[2]:
367 return ret
368
369 # scp needs [<ipv6>]
370 host = self.host
371 if ":" in host:
372 host = f"[{host}]"
373
374 cmd = f"{local} {host}:{remote}"
375 cmd = self._cmd_str(cmd, ssh=SCP_PATH)
376
377 logmsg = f"Executing command: {cmd}"
378 if self.passwd:
379 logmsg = logmsg.replace(self.passwd, ("*" * 6))
380 log.debug(logmsg)
381
382 return self._run_cmd(cmd)
383
384 def _split_cmd(self, cmd):
385 """

Callers 15

pubMethod · 0.45
pub_asyncMethod · 0.45
master_callMethod · 0.45
run_ssh_pre_flightMethod · 0.45
deployMethod · 0.45
deploy_extMethod · 0.45
shim_cmdMethod · 0.45
cmd_blockMethod · 0.45
_send_fileMethod · 0.45

Calls 5

exec_cmdMethod · 0.95
_cmd_strMethod · 0.95
_run_cmdMethod · 0.95
warningMethod · 0.80
debugMethod · 0.80