Skip to content

Commit

Permalink
with the addition of dns_available, renaming available to hostname_av…
Browse files Browse the repository at this point in the history
…ailable
  • Loading branch information
Samuel Beaulieu committed May 29, 2020
1 parent 6304743 commit 41f097c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/vmpooler/pool_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -301,14 +301,14 @@ def find_unique_hostname(pool_name)
hostname_retries = 0
max_hostname_retries = 3
while hostname_retries < max_hostname_retries
hostname, available = generate_and_check_hostname(pool_name)
hostname, hostname_available = generate_and_check_hostname(pool_name)
domain = $config[:config]['domain']
dns_ip, dns_available = check_dns_available(hostname, domain)
break if available && dns_available
break if hostname_available && dns_available

hostname_retries += 1

if !available
if !hostname_available
$metrics.increment("errors.duplicatehostname.#{pool_name}")
$logger.log('s', "[!] [#{pool_name}] Generated hostname #{hostname} was not unique (attempt \##{hostname_retries} of #{max_hostname_retries})")
elsif !dns_available
Expand All @@ -317,7 +317,7 @@ def find_unique_hostname(pool_name)
end
end

raise "Unable to generate a unique hostname after #{hostname_retries} attempts. The last hostname checked was #{hostname}" unless available && dns_available
raise "Unable to generate a unique hostname after #{hostname_retries} attempts. The last hostname checked was #{hostname}" unless hostname_available && dns_available

hostname
end
Expand Down

0 comments on commit 41f097c

Please sign in to comment.