aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/ssh.py
diff options
context:
space:
mode:
authorVratko Polak <vrpolak@cisco.com>2019-08-23 17:02:04 +0200
committerPeter Mikus <pmikus@cisco.com>2019-08-27 05:52:16 +0000
commita6d233d80c359813cc0a350f07449c03d552d166 (patch)
treef58977c64bb18e2788622acc67198e28f6c88152 /resources/libraries/python/ssh.py
parent7186f868f6fd24f8727e088301c4411c2a8e8a8c (diff)
Stop using SSH() in TrafficGenerator.py
This is a partial fix for: Ticket: CSIT-1434 and should fix one pylint violation. Many files to remove SSH() from remain. + Use -E (together with previous -S) in ssh.py when sudo=True. Needed in some cases, no downsides expected. Change-Id: Ie2ad03b3c656a4d3965a61a1e5435276f99a28c0 Signed-off-by: Vratko Polak <vrpolak@cisco.com>
Diffstat (limited to 'resources/libraries/python/ssh.py')
-rw-r--r--resources/libraries/python/ssh.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/resources/libraries/python/ssh.py b/resources/libraries/python/ssh.py
index cee35868e4..1908da4153 100644
--- a/resources/libraries/python/ssh.py
+++ b/resources/libraries/python/ssh.py
@@ -241,9 +241,9 @@ class SSH(object):
if isinstance(cmd, (list, tuple)):
cmd = OptionString(cmd)
if cmd_input is None:
- command = 'sudo -S {c}'.format(c=cmd)
+ command = 'sudo -E -S {c}'.format(c=cmd)
else:
- command = 'sudo -S {c} <<< "{i}"'.format(c=cmd, i=cmd_input)
+ command = 'sudo -E -S {c} <<< "{i}"'.format(c=cmd, i=cmd_input)
return self.exec_command(command, timeout,
log_stdout_err=log_stdout_err)
@@ -267,7 +267,7 @@ class SSH(object):
.format(p=lxc_params, n=lxc_name, c=lxc_cmd)
if sudo:
- command = 'sudo -S {c}'.format(c=command)
+ command = 'sudo -E -S {c}'.format(c=command)
return self.exec_command(command, timeout)
def interactive_terminal_open(self, time_out=45):
@@ -453,8 +453,8 @@ def exec_cmd(node, cmd, timeout=600, sudo=False, disconnect=False):
if not sudo:
(ret_code, stdout, stderr) = ssh.exec_command(cmd, timeout=timeout)
else:
- (ret_code, stdout, stderr) = ssh.exec_command_sudo(cmd,
- timeout=timeout)
+ (ret_code, stdout, stderr) = ssh.exec_command_sudo(
+ cmd, timeout=timeout)
except SSHException as err:
logger.error(repr(err))
return None, None, None