Merge "EC2: Do not tag an instance until it is running"

This commit is contained in:
Zuul 2019-02-04 19:23:09 +00:00 committed by Gerrit Code Review
commit f8f4b623ee
1 changed files with 2 additions and 2 deletions

View File

@ -49,8 +49,6 @@ class AwsInstanceLauncher(NodeLauncher):
attempts += 1
time.sleep(1)
instance.create_tags(Tags=[{'Key': 'nodepool_id',
'Value': str(self.node.id)}])
instance_id = instance.id
self.node.external_id = instance_id
self.zk.storeNode(self.node)
@ -60,6 +58,8 @@ class AwsInstanceLauncher(NodeLauncher):
state = instance.state.get('Name')
self.log.debug("Instance %s is %s" % (instance_id, state))
if state == 'running':
instance.create_tags(Tags=[{'Key': 'nodepool_id',
'Value': str(self.node.id)}])
break
time.sleep(0.5)
instance.reload()