From e6873c765022a4c440f229623aabd30d43d69857 Mon Sep 17 00:00:00 2001 From: vapao Date: Thu, 9 Jan 2020 22:30:03 +0800 Subject: [PATCH] U api update --- spug_api/apps/deploy/utils.py | 2 +- spug_api/libs/ssh.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/spug_api/apps/deploy/utils.py b/spug_api/apps/deploy/utils.py index 9210410..3385b9c 100644 --- a/spug_api/apps/deploy/utils.py +++ b/spug_api/apps/deploy/utils.py @@ -209,7 +209,7 @@ class Helper: self.send_error('local', f'exit code: {task.returncode}') def remote(self, key, ssh, command, env=None): - command, code = 'set -e\n' + command, -1 + code = -1 try: for code, out in ssh.exec_command_with_stream(command, environment=env): self.send_info(key, out) diff --git a/spug_api/libs/ssh.py b/spug_api/libs/ssh.py index 57751ff..f362568 100644 --- a/spug_api/libs/ssh.py +++ b/spug_api/libs/ssh.py @@ -53,6 +53,7 @@ class SSH: sftp.close() def exec_command(self, command, timeout=1800, environment=None): + command = 'set -e\n' + command with self as cli: chan = cli.get_transport().open_session() chan.settimeout(timeout) @@ -65,6 +66,7 @@ class SSH: return chan.recv_exit_status(), out.read() def exec_command_with_stream(self, command, timeout=1800, environment=None): + command = 'set -e\n' + command with self as cli: chan = cli.get_transport().open_session() chan.settimeout(timeout)