1
0
Fork 0
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:
Takuya Sato 2017-10-17 21:30:32 +09:00 committed by Sloane Hertel
parent 836677522d
commit a8bc6f69d9

View file

@ -129,6 +129,7 @@ except ImportError:
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._text import to_text
class EcsTaskManager:
"""Handles ECS Tasks"""
@ -241,10 +242,9 @@ def main():
task_mgr = EcsTaskManager(module)
results = dict(changed=False)
for container in module.params['containers']:
if 'environment' in container:
for environment in container['environment']:
environment['value'] = str(environment['value'])
for container in module.params.get('containers', []):
for environment in container.get('environment', []):
environment['value'] = to_text(environment['value'])
if module.params['state'] == 'present':
if 'containers' not in module.params or not module.params['containers']: