mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 03:41:25 -07:00
Fix modules' use of BOOLEANS*
* The canonical location of BOOLEANS has moved. Switch imports to use that. * clean up argument_spec use of booleans. * Clean up imports to not use wildcards * Remove usage of get_exception
This commit is contained in:
parent
ff22528b07
commit
d64e291274
17 changed files with 98 additions and 102 deletions
|
@ -140,20 +140,24 @@ import json
|
|||
import traceback
|
||||
|
||||
try:
|
||||
import boto3
|
||||
import botocore
|
||||
HAS_BOTO3 = True
|
||||
except ImportError:
|
||||
HAS_BOTO3 = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.ec2 import boto3_conn, ec2_argument_spec, get_aws_connection_info
|
||||
from ansible.module_utils._text import to_native
|
||||
|
||||
|
||||
def main():
|
||||
argument_spec = ec2_argument_spec()
|
||||
argument_spec.update(dict(
|
||||
name = dict(),
|
||||
function_arn = dict(),
|
||||
wait = dict(choices=BOOLEANS, default=True, type='bool'),
|
||||
tail_log = dict(choices=BOOLEANS, default=False, type='bool'),
|
||||
dry_run = dict(choices=BOOLEANS, default=False, type='bool'),
|
||||
wait = dict(default=True, type='bool'),
|
||||
tail_log = dict(default=False, type='bool'),
|
||||
dry_run = dict(default=False, type='bool'),
|
||||
version_qualifier = dict(),
|
||||
payload = dict(default={}, type='dict'),
|
||||
))
|
||||
|
@ -192,7 +196,7 @@ def main():
|
|||
client = boto3_conn(module, conn_type='client', resource='lambda',
|
||||
region=region, endpoint=ec2_url, **aws_connect_kwargs)
|
||||
except (botocore.exceptions.ClientError, botocore.exceptions.ValidationError) as e:
|
||||
module.fail_json(msg="Failure connecting boto3 to AWS", exception=traceback.format_exc())
|
||||
module.fail_json(msg="Failure connecting boto3 to AWS: %s" % to_native(e), exception=traceback.format_exc())
|
||||
|
||||
invoke_params = {}
|
||||
|
||||
|
@ -282,9 +286,6 @@ def main():
|
|||
|
||||
module.exit_json(changed=True, result=results)
|
||||
|
||||
# import module snippets
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.ec2 import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue