mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-01 00:03:10 +00:00
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.
This commit is contained in:
committed by
Brian Coca
parent
eb52dc9af0
commit
10edaabed5
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user