Fix exception syntax for Python 3.x (#2940)
since boto already precludes python2.4, no need to use a common 2.4/3 syntax
This commit is contained in:
parent
4240d2a511
commit
559093f1a3
2 changed files with 7 additions and 7 deletions
|
@ -128,7 +128,7 @@ class CloudWatchEventRule(object):
|
||||||
"""Returns the existing details of the rule in AWS"""
|
"""Returns the existing details of the rule in AWS"""
|
||||||
try:
|
try:
|
||||||
rule_info = self.client.describe_rule(Name=self.name)
|
rule_info = self.client.describe_rule(Name=self.name)
|
||||||
except botocore.exceptions.ClientError, e:
|
except botocore.exceptions.ClientError as e:
|
||||||
error_code = e.response.get('Error', {}).get('Code')
|
error_code = e.response.get('Error', {}).get('Code')
|
||||||
if error_code == 'ResourceNotFoundException':
|
if error_code == 'ResourceNotFoundException':
|
||||||
return {}
|
return {}
|
||||||
|
@ -176,7 +176,7 @@ class CloudWatchEventRule(object):
|
||||||
"""Lists the existing targets for the rule in AWS"""
|
"""Lists the existing targets for the rule in AWS"""
|
||||||
try:
|
try:
|
||||||
targets = self.client.list_targets_by_rule(Rule=self.name)
|
targets = self.client.list_targets_by_rule(Rule=self.name)
|
||||||
except botocore.exceptions.ClientError, e:
|
except botocore.exceptions.ClientError as e:
|
||||||
error_code = e.response.get('Error', {}).get('Code')
|
error_code = e.response.get('Error', {}).get('Code')
|
||||||
if error_code == 'ResourceNotFoundException':
|
if error_code == 'ResourceNotFoundException':
|
||||||
return []
|
return []
|
||||||
|
@ -356,7 +356,7 @@ def get_cloudwatchevents_client(module):
|
||||||
resource='events',
|
resource='events',
|
||||||
region=region, endpoint=ec2_url,
|
region=region, endpoint=ec2_url,
|
||||||
**aws_conn_kwargs)
|
**aws_conn_kwargs)
|
||||||
except boto3.exception.NoAuthHandlerFound, e:
|
except boto3.exception.NoAuthHandlerFound as e:
|
||||||
module.fail_json(msg=str(e))
|
module.fail_json(msg=str(e))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
author:
|
author:
|
||||||
- "Jens Carl (@j-carl), Hothead Games Inc."
|
- "Jens Carl (@j-carl), Hothead Games Inc."
|
||||||
module: redshift_subnet_group
|
module: redshift_subnet_group
|
||||||
version_added: "2.1"
|
version_added: "2.1"
|
||||||
|
@ -128,7 +128,7 @@ def main():
|
||||||
# Connect to the Redshift endpoint.
|
# Connect to the Redshift endpoint.
|
||||||
try:
|
try:
|
||||||
conn = connect_to_aws(boto.redshift, region, **aws_connect_params)
|
conn = connect_to_aws(boto.redshift, region, **aws_connect_params)
|
||||||
except boto.exception.JSONResponseError, e:
|
except boto.exception.JSONResponseError as e:
|
||||||
module.fail_json(msg=str(e))
|
module.fail_json(msg=str(e))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -139,7 +139,7 @@ def main():
|
||||||
try:
|
try:
|
||||||
matching_groups = conn.describe_cluster_subnet_groups(group_name, max_records=100)
|
matching_groups = conn.describe_cluster_subnet_groups(group_name, max_records=100)
|
||||||
exists = len(matching_groups) > 0
|
exists = len(matching_groups) > 0
|
||||||
except boto.exception.JSONResponseError, e:
|
except boto.exception.JSONResponseError as e:
|
||||||
if e.body['Error']['Code'] != 'ClusterSubnetGroupNotFoundFault':
|
if e.body['Error']['Code'] != 'ClusterSubnetGroupNotFoundFault':
|
||||||
#if e.code != 'ClusterSubnetGroupNotFoundFault':
|
#if e.code != 'ClusterSubnetGroupNotFoundFault':
|
||||||
module.fail_json(msg=str(e))
|
module.fail_json(msg=str(e))
|
||||||
|
@ -169,7 +169,7 @@ def main():
|
||||||
|
|
||||||
changed = True
|
changed = True
|
||||||
|
|
||||||
except boto.exception.JSONResponseError, e:
|
except boto.exception.JSONResponseError as e:
|
||||||
module.fail_json(msg=str(e))
|
module.fail_json(msg=str(e))
|
||||||
|
|
||||||
module.exit_json(changed=changed, group=group)
|
module.exit_json(changed=changed, group=group)
|
||||||
|
|
Loading…
Reference in a new issue