8000 Support different VMware products by priscombebur · Pull Request #2 · binjo/vmrun-python · GitHub
[go: up one dir, main page]

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions vmrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def execute( self, path, *cmd ):

cmds = list(cmd)
cmds.insert( 1, "\"%s\"" % self.VM_FILE )
cmds[0] = "-T ws -gu %s -gp %s %s" % (self.VM_ADMIN, self.VM_PASS, cmds[0])
cmds[0] = "-T %s -gu %s -gp %s %s" % (self.VM_PRODUCT, self.VM_ADMIN, self.VM_PASS, cmds[0])
params = " ".join( cmds )

if self.DEBUG: print("[DEBUG] %s" % params)
Expand All @@ -46,9 +46,10 @@ def vmrun(self, *cmd):
return output

# TODO maintain vm's power state
def __init__( self, vmx, user='', password='', vmrun='', debug=False ):
def __init__( self, vmx, user='', password='', vmrun='', debug=False, product='ws' ):

self.VM_FILE = vmx # TODO strict censor?
self.VM_PRODUCT = product # 'ws', 'server' or 'fusion'
self.VM_ADMIN = user
self.VM_PASS = password
self.DEBUG = debug
Expand Down Expand Up @@ -78,6 +79,8 @@ def __init__( self, vmx, user='', password='', vmrun='', debug=False ):
if os.path.exists(tmp_file):
self.VMRUN_PATH = tmp_file
break
# escape spaces in path
self.VMRUN_PATH = self.VMRUN_PATH.replace(' ', '\\ ')

#
# POWER COMMANDS
Expand Down
0