From 10edaabed54467035549e514b5cbe4d78bf38552 Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Mon, 16 May 2016 14:44:51 +0200 Subject: [PATCH] Port module_utils/ec2.py to python 3 syntax (#15879) Since boto is considered as python 2.6 only (cf https://github.com/ansible/ansible/blob/devel/test/utils/run_tests.sh#L15 ), no need to use the 2.4 compatible syntax. --- lib/ansible/module_utils/ec2.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/module_utils/ec2.py b/lib/ansible/module_utils/ec2.py index bd4479fc59e..b0cf050c08c 100644 --- a/lib/ansible/module_utils/ec2.py +++ b/lib/ansible/module_utils/ec2.py @@ -226,13 +226,13 @@ def ec2_connect(module): if region: try: ec2 = connect_to_aws(boto.ec2, region, **boto_params) - except (boto.exception.NoAuthHandlerFound, AnsibleAWSError), e: + except (boto.exception.NoAuthHandlerFound, AnsibleAWSError) as e: module.fail_json(msg=str(e)) # Otherwise, no region so we fallback to the old connection method elif ec2_url: try: ec2 = boto.connect_ec2_endpoint(ec2_url, **boto_params) - except (boto.exception.NoAuthHandlerFound, AnsibleAWSError), e: + except (boto.exception.NoAuthHandlerFound, AnsibleAWSError) as e: module.fail_json(msg=str(e)) else: module.fail_json(msg="Either region or ec2_url must be specified")