mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 10:08:40 -05:00
Simplify run_select_hosts
This commit is contained in:
parent
021633cd49
commit
fedb3632f2
1 changed files with 7 additions and 5 deletions
|
|
@ -85,14 +85,16 @@ module Vmpooler
|
||||||
raise("cluster for pool #{pool_name} cannot be identified") if cluster.nil?
|
raise("cluster for pool #{pool_name} cannot be identified") if cluster.nil?
|
||||||
raise("datacenter for pool #{pool_name} cannot be identified") if datacenter.nil?
|
raise("datacenter for pool #{pool_name} cannot be identified") if datacenter.nil?
|
||||||
dc = "#{datacenter}_#{cluster}"
|
dc = "#{datacenter}_#{cluster}"
|
||||||
if target.key?(dc) and target[dc].key?('checking')
|
select_target_hosts(target, cluster, datacenter) unless target.key?(dc)
|
||||||
|
if target[dc].key?('checking')
|
||||||
wait_for_host_selection(dc, target, loop_delay, max_age)
|
wait_for_host_selection(dc, target, loop_delay, max_age)
|
||||||
elsif target.key?(dc) and target[dc].key?('check_time_finished')
|
end
|
||||||
select_target_hosts(target, cluster, datacenter) if now - target[dc]['check_time_finished'] > max_age
|
if target[dc].key?('check_time_finished')
|
||||||
else
|
if now - target[dc]['check_time_finished'] > max_age
|
||||||
select_target_hosts(target, cluster, datacenter)
|
select_target_hosts(target, cluster, datacenter)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def wait_for_host_selection(dc, target, maxloop = 0, loop_delay = 5, max_age = 60)
|
def wait_for_host_selection(dc, target, maxloop = 0, loop_delay = 5, max_age = 60)
|
||||||
loop_count = 1
|
loop_count = 1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue