mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 01:58:41 -05:00
Don't operate on 'host' object if it doesn't exist
This commit is contained in:
parent
32fee4e0b1
commit
c17637c8b1
1 changed files with 11 additions and 7 deletions
|
|
@ -115,21 +115,25 @@ loop do
|
|||
$redis.srem('vmware_host_pool__completed__'+pool['name'], vm)
|
||||
end
|
||||
|
||||
start = Time.now
|
||||
host = vsphere_helper.find_vms(vm)[vm]
|
||||
|
||||
if host.runtime
|
||||
if (
|
||||
(host) and
|
||||
(host.runtime)
|
||||
)
|
||||
start = Time.now
|
||||
|
||||
if host.runtime.powerState == 'poweredOn'
|
||||
logger.log('d', "[ ] '#{vm}' is being shut down")
|
||||
host.PowerOffVM_Task.wait_for_completion
|
||||
end
|
||||
end
|
||||
|
||||
host.Destroy_Task.wait_for_completion
|
||||
finish = '%.2f' % (Time.now-start)
|
||||
|
||||
logger.log('s', "[-] '#{vm}' destroyed in #{finish} seconds")
|
||||
end
|
||||
end
|
||||
|
||||
# Bring the pool up to the desired size
|
||||
if total < pool['size']
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue