catches exception if conditional cannot be parsed (#5067)

If the conditional cannot be parsed, the module will now catch the exception
and return a well formed failed message.

fixes #5060
pull/18777/head
Peter Sprygada 8 years ago committed by Matt Clay
parent da4c11241f
commit 73cf85d677

@ -263,8 +263,12 @@ def main():
exc = get_exception()
warnings.append('duplicate command detected: %s' % cmd)
for item in conditionals:
runner.add_conditional(item)
try:
for item in conditionals:
runner.add_conditional(item)
except (ValueError, AttributeError):
exc = get_exception()
module.fail_json(msg=str(exc))
runner.retries = module.params['retries']
runner.interval = module.params['interval']

Loading…
Cancel
Save