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