Simplify run_select_hosts

This commit is contained in:
kirby@puppetlabs.com 2017-11-28 13:14:04 -08:00 committed by mattkirby
parent 021633cd49
commit fedb3632f2

View file

@ -85,12 +85,14 @@ 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