minor fix

master
Jonathan Senkerik 2017-05-07 21:09:01 -04:00
parent 279a4ebeab
commit d4d7ae3e4a
2 changed files with 12 additions and 2 deletions

View File

@ -17,7 +17,7 @@ Usage
By default the Disk Store is set to "LeastUsed". This will use the Disk Store with the most free space (in bytes).
By default the ISO or Network are set to "None".
By default the ISO and Network are set to "None".
By default the VM is powered on. If an ISO was specified, then it will boot the ISO image. Otherwise, the VM will attempt a PXE boot. Use COBBLER, Foreman, Razor, or your favorite provisioning tools.

View File

@ -173,8 +173,18 @@ if ISO != "":
try:
(stdin, stdout, stderr) = ssh.exec_command("ls " + str(ISO))
type(stdin)
if not stdout.readlines() and stderr.readlines():
if stdout.readlines() and not stderr.readlines():
ISOfound = True
else:
# If ISO has no "/", try to find the ISO
if not re.match('/', ISO):
#(stdin, stdout, stderr) = ssh.exec_command("find /vmfs/volumes/ -type f -name " + ISO + "-exec sh -c 'echo $1; kill $PPID' sh {} 2>/dev/null \;")
(stdin, stdout, stderr) = ssh.exec_command("find /vmfs/volumes/ -type f -name " + ISO )
type(stdin)
FoundISOPath = str(stdout.readlines())
print "FoundISOPath: " + str(FoundISOPath)
if re.match('/', FoundISOPath):
ISO = FoundISOPath
except:
e = sys.exc_info()[0]
print "The Error is " + str(e)