From 4153391eaf8ebd4af566949bba24e7297dd122fc Mon Sep 17 00:00:00 2001 From: Samuel Beaulieu Date: Thu, 28 Jul 2022 13:22:11 -0500 Subject: [PATCH] do the dns setup earlier, as soon as the vm is ready, to give enough time for the DNS record to propagate --- lib/vmpooler/providers/ec2.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/vmpooler/providers/ec2.rb b/lib/vmpooler/providers/ec2.rb index aa0a91f..f857f86 100644 --- a/lib/vmpooler/providers/ec2.rb +++ b/lib/vmpooler/providers/ec2.rb @@ -265,20 +265,21 @@ module Vmpooler instance_id = batch_instance.first.instance_id connection.client.wait_until(:instance_running, { instance_ids: [instance_id] }) @logger.log('s', "[>] [#{pool_name}] '#{new_vmname}' instance running") + created_instance = get_vm(pool_name, new_vmname) + dns_setup(created_instance) if domain + ### System status checks # This check verifies that your instance is reachable. Amazon EC2 tests that network packets can get to your instance. ### Instance status checks # This check verifies that your instance's operating system is accepting traffic. connection.client.wait_until(:instance_status_ok, { instance_ids: [instance_id] }) @logger.log('s', "[>] [#{pool_name}] '#{new_vmname}' instance ready to accept traffic") - created_instance = get_vm(pool_name, new_vmname) @redis.with_metrics do |redis| redis.hset("vmpooler__vm__#{new_vmname}", 'host', created_instance['private_dns_name']) end if domain - dns_setup(created_instance) provision_node_aws(created_instance['name'], pool_name, new_vmname) if to_provision(pool_name) == 'true' || to_provision(pool_name) == true elsif to_provision(pool_name) == 'true' || to_provision(pool_name) == true provision_node_aws(created_instance['private_dns_name'], pool_name, new_vmname)