From 4615a6cc766d19422cfa82648f475823ba21c37c Mon Sep 17 00:00:00 2001 From: Allen Sanabria Date: Fri, 8 Jul 2016 13:02:33 -0700 Subject: [PATCH] iam_server_certificate_facts: change `except` to python 2.6 syntax --- cloud/amazon/iam_server_certificate_facts.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/cloud/amazon/iam_server_certificate_facts.py b/cloud/amazon/iam_server_certificate_facts.py index d19b6884873..0c334f41944 100644 --- a/cloud/amazon/iam_server_certificate_facts.py +++ b/cloud/amazon/iam_server_certificate_facts.py @@ -26,11 +26,12 @@ requirements: [boto3, botocore] options: name: description: - - The name of the server certificate you are retrieveing attributes for. + - The name of the server certificate you are retrieving attributes for. required: true extends_documentation_fragment: - aws - ec2 +requirements: ['boto3'] ''' EXAMPLES = ''' @@ -83,6 +84,8 @@ upload_date: type: str sample: "2015-04-25T00:36:40+00:00" ''' + + try: import boto3 import botocore.exceptions @@ -147,10 +150,11 @@ def main(): module.fail_json(msg='boto3 required for this module') try: - region, ec2_url, aws_connect_kwargs = get_aws_connection_info(module, boto3=True) - iam = boto3_conn(module, conn_type='client', resource='iam', region=region, endpoint=ec2_url, **aws_connect_kwargs) - except botocore.exceptions.ClientError, e: - module.fail_json(msg="Boto3 Client Error - " + str(e.msg)) + region, ec2_url, aws_connect_kwargs = get_aws_connection_info(module, boto3=True) + iam = boto3_conn(module, conn_type='client', resource='iam', region=region, endpoint=ec2_url, **aws_connect_kwargs) + except botocore.exceptions.ClientError as e: + module.fail_json(msg="Boto3 Client Error - " + str(e.msg)) + cert_name = module.params.get('name') results = get_server_cert(iam, cert_name) module.exit_json(results=results)