コード例 #1
0
    exampleVm.portsFile.setRegularUser(regularUser[0])
    # some possible modifications pointed out
    #exampleVm.vmxFile.setEthernetAdapter(0, "bridged")
    # NAT works well if before hostonly
    # NAT works well if before hostonly
    #exampleVm.vmxFile.setEthernetAdapter(0, "nat")
    #exampleVm.vmxFile.setEthernetAdapter(1, "hostonly")
    # start up for operating system install
    VMwareHypervisor.local.start(exampleVm.vmxFilePath, gui=True, extraSleepSeconds=0)
    VMwareHypervisor.local.sleepUntilNotRunning(exampleVm.vmxFilePath, ticker=True)
    exampleVm.vmxFile.removeAllIdeCdromImages()
    modifiedDistroIsoImage.remove()

# start up for accepting known host key
VMwareHypervisor.local.start(exampleVm.vmxFilePath, gui=True)
exampleVm.sleepUntilHasAcceptedKnownHostKey(ticker=True)

# a possible choice pointed out
#exampleVm.sshCommand([LinuxUtil.commandToEnableSudo(exampleVm.regularUser)])

# a possible choice pointed out
#exampleVm.sshCommand([UbGnome.ubCommandToEnableAutoLogin(exampleVm.regularUser)])

# these ssh commands here are just a demo
print "------"
print exampleVm.sshCommand(["ls", "-al"]).output
print "------"
print exampleVm.sshCommand(["ls nonexistent ; echo `hostname`"]).output
print "------"
# these scp commands here are just a demo
exampleDir = os.path.join(tempfile.gettempdir(), Timestamp.microsecondTimestamp())