mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 01:58:41 -05:00
Merge pull request #338 from quorten/master
(POOLER-148) Fix undefined variable bug in _check_ready_vm.
This commit is contained in:
commit
79bd140ab9
1 changed files with 8 additions and 2 deletions
|
|
@ -156,8 +156,14 @@ module Vmpooler
|
|||
$redis.hset('vmpooler__vm__' + vm, 'check', Time.now)
|
||||
# Check if the hosts TTL has expired
|
||||
if ttl > 0
|
||||
# host['boottime'] may be nil if host is not powered on
|
||||
if ((Time.now - host['boottime']) / 60).to_s[/^\d+\.\d{1}/].to_f > ttl
|
||||
# if 'boottime' is nil, set bootime to beginning of unix epoch, forces TTL to be assumed expired
|
||||
boottime = $redis.hget("vmpooler__vm__#{vm}", 'ready')
|
||||
if boottime
|
||||
boottime = Time.parse(boottime)
|
||||
else
|
||||
boottime = Time.at(0)
|
||||
end
|
||||
if ((Time.now - boottime) / 60).to_s[/^\d+\.\d{1}/].to_f > ttl
|
||||
$redis.smove('vmpooler__ready__' + pool_name, 'vmpooler__completed__' + pool_name, vm)
|
||||
|
||||
$logger.log('d', "[!] [#{pool_name}] '#{vm}' reached end of TTL after #{ttl} minutes, removed from 'ready' queue")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue