From d36537513ed970dcfe3d0c05002375ac361477ad Mon Sep 17 00:00:00 2001 From: Benjamin Ness Date: Fri, 20 Apr 2018 17:30:10 -0500 Subject: [PATCH] [ec2_ami] Add missing parameters while handling botocore Exceptions. Fixes TypeError exception (#39105) --- lib/ansible/modules/cloud/amazon/ec2_ami.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/cloud/amazon/ec2_ami.py b/lib/ansible/modules/cloud/amazon/ec2_ami.py index c37e2e68e34..02c6c51eec1 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_ami.py +++ b/lib/ansible/modules/cloud/amazon/ec2_ami.py @@ -626,9 +626,9 @@ def get_image_by_id(module, connection, image_id): result['ProductCodes'] = connection.describe_image_attribute(Attribute='productCodes', ImageId=image_id)['ProductCodes'] except botocore.exceptions.ClientError as e: if e.response['Error']['Code'] != 'InvalidAMIID.Unavailable': - module.fail_json_aws(e, msg="Error retrieving image attributes" % image_id) + module.fail_json_aws(e, msg="Error retrieving image attributes %s" % image_id) except botocore.exceptions.BotoCoreError as e: - module.fail_json_aws(e, msg="Error retrieving image attributes" % image_id) + module.fail_json_aws(e, msg="Error retrieving image attributes %s" % image_id) return result module.fail_json(msg="Invalid number of instances (%s) found for image_id: %s." % (str(len(images)), image_id)) except (botocore.exceptions.BotoCoreError, botocore.exceptions.ClientError) as e: