We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents e3d3ed2 + ad3028d commit fcc5cebCopy full SHA for fcc5ceb
1 file changed
provider/ec2.py
@@ -147,13 +147,17 @@ def destroy_node(node):
147
region = node['params'].get('region', 'us-east-1')
148
conn = _create_ec2_connection(node['creds'], region)
149
if provider_id:
150
- conn.terminate_instances([provider_id])
151
- i = conn.get_all_instances([provider_id])[0].instances[0]
152
- while(True):
153
- time.sleep(2)
154
- i.update()
155
- if i.state == "terminated":
156
- break
+ try:
+ conn.terminate_instances([provider_id])
+ i = conn.get_all_instances([provider_id])[0].instances[0]
+ while(True):
+ time.sleep(2)
+ i.update()
+ if i.state == "terminated":
157
+ break
158
+ except EC2ResponseError as e:
159
+ if e.code not in ('InvalidInstanceID.NotFound',):
160
+ raise
161
162
163
def _create_ec2_connection(creds, region):
0 commit comments