Merge pull request #1103 from coreos-inc/botoerrorcode

Boto error_code is a string, not the HTTP status code
This commit is contained in:
josephschorr 2015-12-23 15:14:04 -05:00
commit 16f16e8a15

View file

@ -161,7 +161,7 @@ class EC2Executor(BuilderExecutor):
'BuildUUID': build_uuid, 'BuildUUID': build_uuid,
})) }))
except boto.exception.EC2ResponseError as ec2e: except boto.exception.EC2ResponseError as ec2e:
if ec2e.error_code == 404: if ec2e.error_code == 'InvalidInstanceID.NotFound':
if i < _TAG_RETRY_COUNT - 1: if i < _TAG_RETRY_COUNT - 1:
logger.warning('Failed to write EC2 tags (attempt #%s)', i) logger.warning('Failed to write EC2 tags (attempt #%s)', i)
yield From(trollius.sleep(_TAG_RETRY_SLEEP)) yield From(trollius.sleep(_TAG_RETRY_SLEEP))
@ -179,7 +179,7 @@ class EC2Executor(BuilderExecutor):
ec2_conn = self._get_conn() ec2_conn = self._get_conn()
terminated_instances = yield From(ec2_conn.terminate_instances([builder_id])) terminated_instances = yield From(ec2_conn.terminate_instances([builder_id]))
except boto.exception.EC2ResponseError as ec2e: except boto.exception.EC2ResponseError as ec2e:
if ec2e.error_code == 404: if ec2e.error_code == 'InvalidInstanceID.NotFound':
logger.debug('Instance %s already terminated', builder_id) logger.debug('Instance %s already terminated', builder_id)
return return