vmcontrol.py -s snapshot name is not marked required
jtpereyda opened this issue · comments
Joshua Pereyda commented
The vmcontrol usage text indicates that -x
and -r
are required, but I think -s is also required.
ERR> USAGE: vmcontrol.py
<-x|--vmx FILENAME|NAME> path to VMX to control or name of VirtualBox image
<-r|--vmrun FILENAME> path to vmrun.exe or VBoxManage
[-s|--snapshot NAME> set the snapshot name
[-l|--log_level LEVEL] log level (default 1), increase for more verbosity
[-i|--interactive] Interactive mode, prompts for input values
[--port PORT] TCP port to bind this agent to
[--vbox] control an Oracle VirtualBox VM
Running without a snapshot name gives an exception. The snapshot name defaults to None and is never checked:
C:\Users\josh\code\fuzzes\sulley-repo>python vmcontrol.py -x "C:\Users\josh\Virtua
l Machines\Ubuntu 64-bit\Ubuntu 64-bit.vmx" -r "C:\Program Files (x86)\VMware\VMware VIX\v
mrun.exe"
[02:34.42] VMControl PED-RPC server initialized:
[02:34.42] vmrun: C:\PROGRA~2\VMware\VMWARE~2\vmrun.exe
[02:34.42] vmx: C:\Users\josh\VIRTUA~3\UBUNTU~1\UBUNTU~1.VMX
[02:34.42] snap name: None
[02:34.42] log level: 1
[02:34.42] Awaiting requests...
[02:35.09] restarting virtual machine...
Traceback (most recent call last):
File "vmcontrol.py", line 596, in <module>
servlet.serve_forever()
File "C:\Users\josh\code\fuzzes\sulley-repo\sulley\pedrpc.py", line 299, in serve_fo
rever
ret = method_pointer(*args, **kwargs)
File "vmcontrol.py", line 286, in restart_target
self.revert_to_snapshot()
File "vmcontrol.py", line 241, in revert_to_snapshot
command = self.vmrun + " revertToSnapshot " + self.vmx + " " + '"' + snap_name + '"'
TypeError: cannot concatenate 'str' and 'NoneType' objects
C:\Users\josh\code\fuzzes\sulley-repo>
The most obvious fix I see is to make the argument required. I'm happy to fix it if that seems to be the right thing.
Ryan commented
Hey @jtpereyda, I actually didn't write the vmcontrol stuff, but that sounds reasonable. I can't imagine a scenario where you'd use this without a snapshot.
Cheers!
Fitblip
Joshua Pereyda commented
Fixed in pull request #80, merged 2015.06.30.