+ if cancel_installation:
+ # Remove installation directory on DUT
+ cmd = "rm -r {}".format(install_dir)
+ stdout = ssh_ignore_error(ssh, cmd)
+ print "###TI {}".format(stdout)
+
+ cmd = "dpkg -l | grep vpp"
+ ret, _, _ = ssh.exec_command(cmd)
+ if ret == 0:
+ # Try to fix interrupted installations
+ cmd = 'dpkg --configure -a'
+ stdout = ssh_no_error(ssh, cmd, sudo=True)
+ print "###TI {}".format(stdout)
+ # Try to remove installed vpp.* packages
+ cmd = 'apt-get purge -y "vpp.*"'
+ stdout = ssh_no_error(ssh, cmd, sudo=True)
+ print "###TI {}".format(stdout)
+ else:
+ # Create installation directory on DUT
+ cmd = "mkdir {}".format(install_dir)
+ stdout = ssh_no_error(ssh, cmd)
+ print "###TI {}".format(stdout)
+
+ # Copy packages from local path to installation dir
+ for deb in packages:
+ print "###TI scp: {}".format(deb)
+ ssh.scp(local_path=deb, remote_path=install_dir)
+
+ cmd = "dpkg -l | grep vpp"
+ ret, _, _ = ssh.exec_command(cmd)
+ if ret == 0:
+ # Try to fix interrupted installations
+ cmd = 'dpkg --configure -a'
+ stdout = ssh_no_error(ssh, cmd, sudo=True)
+ print "###TI {}".format(stdout)
+ # Try to remove installed vpp.* packages
+ cmd = 'apt-get purge -y "vpp.*"'
+ stdout = ssh_no_error(ssh, cmd, sudo=True)
+ print "###TI {}".format(stdout)