Fix redshift module Python 3.5 syntax

pull/18777/head
Ryan S. Brown 8 years ago committed by Matt Clay
parent 559093f1a3
commit ce72e52c50

@ -17,7 +17,7 @@
DOCUMENTATION = ''' DOCUMENTATION = '''
--- ---
author: author:
- "Jens Carl (@j-carl), Hothead Games Inc." - "Jens Carl (@j-carl), Hothead Games Inc."
module: redshift module: redshift
version_added: "2.1" version_added: "2.1"
@ -293,15 +293,15 @@ def create_cluster(module, redshift):
try: try:
redshift.describe_clusters(identifier)['DescribeClustersResponse']['DescribeClustersResult']['Clusters'][0] redshift.describe_clusters(identifier)['DescribeClustersResponse']['DescribeClustersResult']['Clusters'][0]
changed = False changed = False
except boto.exception.JSONResponseError, e: except boto.exception.JSONResponseError as e:
try: try:
redshift.create_cluster(identifier, node_type, username, password, **params) redshift.create_cluster(identifier, node_type, username, password, **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:
resource = redshift.describe_clusters(identifier)['DescribeClustersResponse']['DescribeClustersResult']['Clusters'][0] resource = redshift.describe_clusters(identifier)['DescribeClustersResponse']['DescribeClustersResult']['Clusters'][0]
except boto.exception.JSONResponseError, e: except boto.exception.JSONResponseError as e:
module.fail_json(msg=str(e)) module.fail_json(msg=str(e))
if wait: if wait:
@ -316,7 +316,7 @@ def create_cluster(module, redshift):
resource = redshift.describe_clusters(identifier)['DescribeClustersResponse']['DescribeClustersResult']['Clusters'][0] resource = redshift.describe_clusters(identifier)['DescribeClustersResponse']['DescribeClustersResult']['Clusters'][0]
except boto.exception.JSONResponseError, e: except boto.exception.JSONResponseError as e:
module.fail_json(msg=str(e)) module.fail_json(msg=str(e))
return(changed, _collect_facts(resource)) return(changed, _collect_facts(resource))
@ -333,7 +333,7 @@ def describe_cluster(module, redshift):
try: try:
resource = redshift.describe_clusters(identifier)['DescribeClustersResponse']['DescribeClustersResult']['Clusters'][0] resource = redshift.describe_clusters(identifier)['DescribeClustersResponse']['DescribeClustersResult']['Clusters'][0]
except boto.exception.JSONResponseError, e: except boto.exception.JSONResponseError as e:
module.fail_json(msg=str(e)) module.fail_json(msg=str(e))
return(True, _collect_facts(resource)) return(True, _collect_facts(resource))
@ -353,7 +353,7 @@ def delete_cluster(module, redshift):
try: try:
redshift.delete_custer( identifier ) redshift.delete_custer( identifier )
except boto.exception.JSONResponseError, e: except boto.exception.JSONResponseError as e:
module.fail_json(msg=str(e)) module.fail_json(msg=str(e))
if wait: if wait:
@ -368,7 +368,7 @@ def delete_cluster(module, redshift):
resource = redshift.describe_clusters(identifier)['DescribeClustersResponse']['DescribeClustersResult']['Clusters'][0] resource = redshift.describe_clusters(identifier)['DescribeClustersResponse']['DescribeClustersResult']['Clusters'][0]
except boto.exception.JSONResponseError, e: except boto.exception.JSONResponseError as e:
module.fail_json(msg=str(e)) module.fail_json(msg=str(e))
return(True, {}) return(True, {})
@ -400,15 +400,15 @@ def modify_cluster(module, redshift):
try: try:
redshift.describe_clusters(identifier)['DescribeClustersResponse']['DescribeClustersResult']['Clusters'][0] redshift.describe_clusters(identifier)['DescribeClustersResponse']['DescribeClustersResult']['Clusters'][0]
changed = False changed = False
except boto.exception.JSONResponseError, e: except boto.exception.JSONResponseError as e:
try: try:
redshift.modify_cluster(identifier, **params) redshift.modify_cluster(identifier, **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:
resource = redshift.describe_clusters(identifier)['DescribeClustersResponse']['DescribeClustersResult']['Clusters'][0] resource = redshift.describe_clusters(identifier)['DescribeClustersResponse']['DescribeClustersResult']['Clusters'][0]
except boto.exception.JSONResponseError, e: except boto.exception.JSONResponseError as e:
module.fail_json(msg=str(e)) module.fail_json(msg=str(e))
if wait: if wait:
@ -423,7 +423,7 @@ def modify_cluster(module, redshift):
resource = redshift.describe_clusters(identifier)['DescribeClustersResponse']['DescribeClustersResult']['Clusters'][0] resource = redshift.describe_clusters(identifier)['DescribeClustersResponse']['DescribeClustersResult']['Clusters'][0]
except boto.exception.JSONResponseError, e: except boto.exception.JSONResponseError as e:
# https://github.com/boto/boto/issues/2776 is fixed. # https://github.com/boto/boto/issues/2776 is fixed.
module.fail_json(msg=str(e)) module.fail_json(msg=str(e))
@ -476,7 +476,7 @@ def main():
# connect to the rds endpoint # connect to the rds 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))
changed = True changed = True

Loading…
Cancel
Save