Merge pull request #6306 from willthames/ec2_module_clearer_failures

Make it easier to determine whether instance creation or tagging fails
This commit is contained in:
Michael DeHaan 2014-03-11 10:18:50 -05:00
commit 1eed6f46bf

View file

@ -816,7 +816,7 @@ def create_instances(module, ec2, override_count=None):
res = ec2.run_instances(**params) res = ec2.run_instances(**params)
except boto.exception.BotoServerError, e: except boto.exception.BotoServerError, e:
module.fail_json(msg = "%s: %s" % (e.error_code, e.error_message)) module.fail_json(msg = "Instance creation failed => %s: %s" % (e.error_code, e.error_message))
instids = [ i.id for i in res.instances ] instids = [ i.id for i in res.instances ]
while True: while True:
@ -834,7 +834,7 @@ def create_instances(module, ec2, override_count=None):
try: try:
ec2.create_tags(instids, instance_tags) ec2.create_tags(instids, instance_tags)
except boto.exception.EC2ResponseError, e: except boto.exception.EC2ResponseError, e:
module.fail_json(msg = "%s: %s" % (e.error_code, e.error_message)) module.fail_json(msg = "Instance tagging failed => %s: %s" % (e.error_code, e.error_message))
# wait here until the instances are up # wait here until the instances are up
this_res = [] this_res = []