1 import utils 2 3 print "Instantiating a machine object" 4 m = hosts.create_host(machines[0]) 5 print "Passed" 6 7 print 8 9 print "Pinging" 10 if m.is_up(): 11 print "Passed" 12 else: 13 raise "Failed" 14 15 print 16 17 print "Waiting for ssh" 18 m.wait_up(5) 19 print "Passed" 20 21 print 22 23 print "Running ls on remote machine via host.run" 24 if m.run('ls -d /etc').stdout.strip() == '/etc': 25 print "Passed" 26 else: 27 raise "Failed" 28 29 utils.run('rm -f /tmp/motd') 30 print "Removing temporary file from remote machine" 31 m.run('rm -f /tmp/motd') 32 print "Running send_file remote machine" 33 m.send_file('/etc/motd', '/tmp/motd') 34 print "Running get_file remote machine" 35 m.get_file('/tmp/motd', '/tmp/motd') 36 print "Verifying files match" 37 if utils.run('diff -q /etc/motd /tmp/motd').exit_status: 38 raise "Failed" 39 print "Removing temporary file from remote machine" 40 m.run('rm -f /tmp/motd') 41 print "Passed" 42 utils.run('rm -f /tmp/motd') 43 44 print 45 46