iam_server_certificate_facts: change `except` to python 2.6 syntax

reviewable/pr18780/r1
Allen Sanabria 9 years ago committed by Ryan S. Brown
parent c574dbee54
commit 4615a6cc76

@ -26,11 +26,12 @@ requirements: [boto3, botocore]
options: options:
name: name:
description: 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 required: true
extends_documentation_fragment: extends_documentation_fragment:
- aws - aws
- ec2 - ec2
requirements: ['boto3']
''' '''
EXAMPLES = ''' EXAMPLES = '''
@ -83,6 +84,8 @@ upload_date:
type: str type: str
sample: "2015-04-25T00:36:40+00:00" sample: "2015-04-25T00:36:40+00:00"
''' '''
try: try:
import boto3 import boto3
import botocore.exceptions import botocore.exceptions
@ -147,10 +150,11 @@ def main():
module.fail_json(msg='boto3 required for this module') module.fail_json(msg='boto3 required for this module')
try: try:
region, ec2_url, aws_connect_kwargs = get_aws_connection_info(module, boto3=True) 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) iam = boto3_conn(module, conn_type='client', resource='iam', region=region, endpoint=ec2_url, **aws_connect_kwargs)
except botocore.exceptions.ClientError, e: except botocore.exceptions.ClientError as e:
module.fail_json(msg="Boto3 Client Error - " + str(e.msg)) module.fail_json(msg="Boto3 Client Error - " + str(e.msg))
cert_name = module.params.get('name') cert_name = module.params.get('name')
results = get_server_cert(iam, cert_name) results = get_server_cert(iam, cert_name)
module.exit_json(results=results) module.exit_json(results=results)

Loading…
Cancel
Save