consul + Python 3.5 (#23935)

* Fix #23934 - consul + Python 3.5
* List comprehension instead of filter with lambda
This commit is contained in:
William Griffiths 2017-09-10 02:41:08 +01:00 committed by Toshio Kuratomi
parent 8e4f112b39
commit ab7c850360

View file

@ -359,9 +359,9 @@ def get_service_by_id_or_name(consul_api, service_id_or_name):
def parse_check(module):
if len(filter(None, [module.params.get('script'), module.params.get('ttl'), module.params.get('http')])) > 1:
if len([p for p in (module.params.get('script'), module.params.get('ttl'), module.params.get('http')) if p]) > 1:
module.fail_json(
msg='check are either script, http or ttl driven, supplying more than one does not make sense')
msg='checks are either script, http or ttl driven, supplying more than one does not make sense')
if module.params.get('check_id') or module.params.get('script') or module.params.get('ttl') or module.params.get('http'):