1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

correctly iterate and return results of any service checks. ()

current implementation was breaking making the module unusable, changing to the list comprehension fixes this. Also default to seconds instead of throwing a exception when no duration units are supplied as this causes tests to fail
This commit is contained in:
Steve Gargan 2016-09-08 07:17:56 +02:00 committed by Matt Clay
parent d00e941a0e
commit 7cd3da9b58

View file

@ -315,7 +315,7 @@ def add_service(module, service):
service_id=result.id,
service_name=result.name,
service_port=result.port,
checks=map(lambda x: x.to_dict(), service.checks),
checks=[check.to_dict() for check in service.checks],
tags=result.tags)
@ -484,8 +484,7 @@ class ConsulCheck():
if duration:
duration_units = ['ns', 'us', 'ms', 's', 'm', 'h']
if not any((duration.endswith(suffix) for suffix in duration_units)):
raise Exception('Invalid %s %s you must specify units (%s)' %
(name, duration, ', '.join(duration_units)))
duration = "{}s".format(duration)
return duration
def register(self, consul_api):