diff options
Diffstat (limited to 'scripts/automation/regression/misc_methods.py')
-rwxr-xr-x | scripts/automation/regression/misc_methods.py | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/scripts/automation/regression/misc_methods.py b/scripts/automation/regression/misc_methods.py index 2341b9be..b5cf79e0 100755 --- a/scripts/automation/regression/misc_methods.py +++ b/scripts/automation/regression/misc_methods.py @@ -26,23 +26,16 @@ def run_command(cmd): (stdout, stderr) = proc.communicate() if stdout: print 'Stdout:\n%s' % stdout - if stderr: - print 'Stderr:\n%s' % stderr - print 'Return code: %s' % proc.returncode + if proc.returncode: + if stderr: + print 'Stderr:\n%s' % stderr + print 'Return code: %s' % proc.returncode return (proc.returncode, stdout, stderr) -def run_remote_command(host, passwd, command_string): +def run_remote_command(host, command_string): cmd = 'ssh -tt %s \'sudo sh -c "%s"\'' % (host, command_string) - print 'Trying connection with ssh...' - return_code, stdout, stderr = run_command(cmd) - if return_code == 0: - return (return_code, stdout, stderr) - elif passwd is not None: - print 'Trying connection with expect + sshpass.exp...' - cmd = 'sshpass.exp %s %s root "%s"' % (passwd, host, command_string) - return_code, stdout, stderr = run_command(cmd) - return (return_code, stdout, stderr) + return run_command(cmd) def generate_intf_lists (interfacesList): |