From 0f353ed99d0b134fbb2e052a8011f726b4d54cdc Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Thu, 28 Feb 2019 20:11:59 +0530 Subject: [PATCH] AWS: handle boto3 credential file parsing error (#53098) Fixes: #53051 Signed-off-by: Abhijeet Kasurde --- lib/ansible/module_utils/ec2.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ansible/module_utils/ec2.py b/lib/ansible/module_utils/ec2.py index d2ad715bef..f59448cafd 100644 --- a/lib/ansible/module_utils/ec2.py +++ b/lib/ansible/module_utils/ec2.py @@ -117,7 +117,8 @@ def boto3_conn(module, conn_type=None, resource=None, region=None, endpoint=None return _boto3_conn(conn_type=conn_type, resource=resource, region=region, endpoint=endpoint, **params) except ValueError as e: module.fail_json(msg="Couldn't connect to AWS: %s" % to_native(e)) - except (botocore.exceptions.ProfileNotFound, botocore.exceptions.PartialCredentialsError, botocore.exceptions.NoCredentialsError) as e: + except (botocore.exceptions.ProfileNotFound, botocore.exceptions.PartialCredentialsError, + botocore.exceptions.NoCredentialsError, botocore.exceptions.ConfigParseError) as e: module.fail_json(msg=to_native(e)) except botocore.exceptions.NoRegionError as e: module.fail_json(msg="The %s module requires a region and none was found in configuration, "