[cloud] Support check_mode for ec2_group_facts (#23164)

Update imports to use named imports
This commit is contained in:
Will Thames 2017-04-04 03:45:38 +10:00 committed by Ryan Brown
parent 2b18c0ed07
commit cd19964bca

View file

@ -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()