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:
parent
eb52dc9af0
commit
10edaabed5
1 changed files with 2 additions and 2 deletions
|
@ -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")
|
||||
|
|
Loading…
Reference in a new issue