mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
skip check environment parameter if has no containers. (#31083)
* skip check environment parameter if has no containers. * optimize code
This commit is contained in:
parent
836677522d
commit
a8bc6f69d9
1 changed files with 4 additions and 4 deletions
|
@ -129,6 +129,7 @@ except ImportError:
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.ec2 import boto3_conn, camel_dict_to_snake_dict, ec2_argument_spec, get_aws_connection_info
|
from ansible.module_utils.ec2 import boto3_conn, camel_dict_to_snake_dict, ec2_argument_spec, get_aws_connection_info
|
||||||
|
from ansible.module_utils._text import to_text
|
||||||
|
|
||||||
class EcsTaskManager:
|
class EcsTaskManager:
|
||||||
"""Handles ECS Tasks"""
|
"""Handles ECS Tasks"""
|
||||||
|
@ -241,10 +242,9 @@ def main():
|
||||||
task_mgr = EcsTaskManager(module)
|
task_mgr = EcsTaskManager(module)
|
||||||
results = dict(changed=False)
|
results = dict(changed=False)
|
||||||
|
|
||||||
for container in module.params['containers']:
|
for container in module.params.get('containers', []):
|
||||||
if 'environment' in container:
|
for environment in container.get('environment', []):
|
||||||
for environment in container['environment']:
|
environment['value'] = to_text(environment['value'])
|
||||||
environment['value'] = str(environment['value'])
|
|
||||||
|
|
||||||
if module.params['state'] == 'present':
|
if module.params['state'] == 'present':
|
||||||
if 'containers' not in module.params or not module.params['containers']:
|
if 'containers' not in module.params or not module.params['containers']:
|
||||||
|
|
Loading…
Reference in a new issue