mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 10:08:40 -05:00
(POOLER-148) Fix undefined variable bug in _check_ready_vm.
The host['boottime'] variable in the function _check_ready_vm no longer has its parent object in reference due to the refactoring in pull request #269. So in order to get the same information without the performance impact from duplicate object lookups, we get similar information from the time that the VM is ready.
This commit is contained in:
parent
df90d56721
commit
79ac9ad37e
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
|
||||
# 'boottime' may be nil if host is not powered on
|
||||
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