Skip to content

Commit

Permalink
Add debug messages for scp
Browse files Browse the repository at this point in the history
SSH commands are logged, but not SCPs. Add it.

Signed-off-by: Samuel Verschelde <[email protected]>
  • Loading branch information
stormi committed Nov 18, 2021
1 parent ded84cd commit c342349
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ def scp(hostname_or_ip, src, dest, check=True, suppress_fingerprint_warnings=Tru
stderr=subprocess.STDOUT,
check=False
)

errorcode_msg = "" if res.returncode == 0 else " - Got error code: %s" % res.returncode
logging.debug(f"[{hostname_or_ip}] scp: {src} => {dest}{errorcode_msg}")

if check and res.returncode:
raise SSHCommandFailed(res.returncode, res.stdout.decode(), command)

Expand Down

0 comments on commit c342349

Please sign in to comment.