from resources.libraries.python.ssh import SSH
+
def ssh_no_error(ssh, cmd, sudo=False):
"""Execute a command over ssh channel, and log and exit if the command
fails.
"""
if sudo:
- ret, stdo, stde = ssh.exec_command_sudo(cmd)
+ ret, stdo, stde = ssh.exec_command_sudo(cmd, timeout=60)
else:
- ret, stdo, stde = ssh.exec_command(cmd)
+ ret, stdo, stde = ssh.exec_command(cmd, timeout=60)
if ret != 0:
print 'Command execution failed: "{}"'.format(cmd)
return stdo
+
def ssh_ignore_error(ssh, cmd, sudo=False):
"""Execute a command over ssh channel, ignore errors.
return stdo
+
def main():
"""Copy and installation of VPP packages."""
print "###TI {}".format(stdout)
else:
# Create installation directory on DUT
- cmd = "mkdir {}".format(install_dir)
+ cmd = "rm -r {0}; mkdir {0}".format(install_dir)
stdout = ssh_no_error(ssh, cmd)
print "###TI {}".format(stdout)