diff options
author | Steve Gargan <steve.gargan@intercom.io> | 2016-09-08 07:17:56 +0200 |
---|---|---|
committer | René Moser <mail@renemoser.net> | 2016-09-08 07:17:56 +0200 |
commit | 64ace27be33d81f605e29400b71ff1406e08205f (patch) | |
tree | 5ec7d435e951b6c8be397c49baea5644fbe67a0f /clustering/consul.py | |
parent | 6a7358b14e66a92d96d67c2158409549737d5ddd (diff) | |
download | ansible-modules-extras-64ace27be33d81f605e29400b71ff1406e08205f.tar.gz |
correctly iterate and return results of any service checks. (#2878)
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
Diffstat (limited to 'clustering/consul.py')
-rw-r--r-- | clustering/consul.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/clustering/consul.py b/clustering/consul.py index 002aca3e..b9cdfb09 100644 --- a/clustering/consul.py +++ b/clustering/consul.py @@ -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): |