diff options
author | René Moser <mail@renemoser.net> | 2016-08-30 23:38:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-30 23:38:07 +0200 |
commit | 1c4f346691654b47084fc932aae5dce79e0d3dd5 (patch) | |
tree | 74d7d086754268a5004d6bb0eac8745f07af3cf5 | |
parent | 2c78dea646975f7e32cc40bc05bb5c1eacb67359 (diff) | |
download | ansible-modules-extras-1c4f346691654b47084fc932aae5dce79e0d3dd5.tar.gz |
ec2_vpc_dhcp_options_facts: fix exception handling, fixes build (#2819)
-rw-r--r-- | cloud/amazon/ec2_vpc_dhcp_options_facts.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/cloud/amazon/ec2_vpc_dhcp_options_facts.py b/cloud/amazon/ec2_vpc_dhcp_options_facts.py index 8c59aeb5..a60a2104 100644 --- a/cloud/amazon/ec2_vpc_dhcp_options_facts.py +++ b/cloud/amazon/ec2_vpc_dhcp_options_facts.py @@ -81,7 +81,7 @@ import json try: import botocore - import boto3 + import boto3 HAS_BOTO3 = True except ImportError: HAS_BOTO3 = False @@ -128,7 +128,7 @@ def list_dhcp_options(client, module): snaked_dhcp_options_array = [] for dhcp_option in all_dhcp_options_array: snaked_dhcp_options_array.append(camel_dict_to_snake_dict(dhcp_option)) - + module.exit_json(dhcp_options=snaked_dhcp_options_array) @@ -151,12 +151,12 @@ def main(): try: region, ec2_url, aws_connect_kwargs = get_aws_connection_info(module, boto3=True) connection = boto3_conn(module, conn_type='client', resource='ec2', region=region, endpoint=ec2_url, **aws_connect_kwargs) - except botocore.exceptions.NoCredentialsError, e: + except botocore.exceptions.NoCredentialsError as e: module.fail_json(msg="Can't authorize connection - "+str(e)) # call your function here results = list_dhcp_options(connection, module) - + module.exit_json(result=results) # import module snippets |