From cd19964bcaf68b51b25c46e6f8e755c12e5596a5 Mon Sep 17 00:00:00 2001 From: Will Thames Date: Tue, 4 Apr 2017 03:45:38 +1000 Subject: [PATCH] [cloud] Support check_mode for ec2_group_facts (#23164) Update imports to use named imports --- .../modules/cloud/amazon/ec2_group_facts.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/ansible/modules/cloud/amazon/ec2_group_facts.py b/lib/ansible/modules/cloud/amazon/ec2_group_facts.py index cf6022d0cc..4f1c68c0e4 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_group_facts.py +++ b/lib/ansible/modules/cloud/amazon/ec2_group_facts.py @@ -98,12 +98,15 @@ security_groups: ''' +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.ec2 import ec2_argument_spec, boto3_conn, HAS_BOTO3 +from ansible.module_utils.ec2 import get_aws_connection_info, boto3_tag_list_to_ansible_dict +from ansible.module_utils.ec2 import ansible_dict_to_boto3_filter_list, camel_dict_to_snake_dict + try: - import boto3 from botocore.exceptions import ClientError - HAS_BOTO3 = True except ImportError: - HAS_BOTO3 = False + pass # caught by imported HAS_BOTO3 import traceback @@ -116,7 +119,8 @@ def main(): ) ) - module = AnsibleModule(argument_spec=argument_spec) + module = AnsibleModule(argument_spec=argument_spec, + supports_check_mode=True) if not HAS_BOTO3: module.fail_json(msg='boto3 required for this module') @@ -161,8 +165,5 @@ def main(): module.exit_json(security_groups=snaked_security_groups) -from ansible.module_utils.basic import * -from ansible.module_utils.ec2 import * - if __name__ == '__main__': main()