summaryrefslogtreecommitdiffstats
path: root/scripts/automation/regression/misc_methods.py
diff options
context:
space:
mode:
authorYaroslav Brustinov <ybrustin@cisco.com>2016-03-25 13:33:23 +0300
committerYaroslav Brustinov <ybrustin@cisco.com>2016-03-25 13:33:23 +0300
commit1f749d9b568893aa26ff115d18b8f9ef4d0b2603 (patch)
treef694feff39719af32634325e9a8f2cebad424f3e /scripts/automation/regression/misc_methods.py
parentec963b31b4a7be04a11c5e0f7684cc22312eba76 (diff)
add timeout to ssh commands
Diffstat (limited to 'scripts/automation/regression/misc_methods.py')
-rwxr-xr-xscripts/automation/regression/misc_methods.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/scripts/automation/regression/misc_methods.py b/scripts/automation/regression/misc_methods.py
index 54e3ba5d..97d168b0 100755
--- a/scripts/automation/regression/misc_methods.py
+++ b/scripts/automation/regression/misc_methods.py
@@ -42,8 +42,8 @@ def run_command(cmd, background = False):
return (proc.returncode, stdout, stderr)
-def run_remote_command(host, command_string, background = False):
- cmd = 'ssh -tt %s \'sudo sh -ec "%s"\'' % (host, command_string)
+def run_remote_command(host, command_string, background = False, timeout = 20):
+ cmd = 'ssh -tt %s \'sudo%s sh -ec "%s"\'' % (host, (' timeout %s' % timeout) if (timeout and not background) else '', command_string)
return run_command(cmd, background)