mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-27 21:01:27 -07:00
[cloud] Support check_mode for ec2_group_facts (#23164)
Update imports to use named imports
This commit is contained in:
parent
2b18c0ed07
commit
cd19964bca
1 changed files with 8 additions and 7 deletions
|
@ -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:
|
try:
|
||||||
import boto3
|
|
||||||
from botocore.exceptions import ClientError
|
from botocore.exceptions import ClientError
|
||||||
HAS_BOTO3 = True
|
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_BOTO3 = False
|
pass # caught by imported HAS_BOTO3
|
||||||
|
|
||||||
import traceback
|
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:
|
if not HAS_BOTO3:
|
||||||
module.fail_json(msg='boto3 required for this module')
|
module.fail_json(msg='boto3 required for this module')
|
||||||
|
@ -161,8 +165,5 @@ def main():
|
||||||
module.exit_json(security_groups=snaked_security_groups)
|
module.exit_json(security_groups=snaked_security_groups)
|
||||||
|
|
||||||
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.ec2 import *
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue