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
reviewable/pr18780/r1
Peter Sprygada 8 years ago committed by GitHub
parent a1c3ce0ad1
commit 340ff31075

@ -263,8 +263,12 @@ def main():
exc = get_exception() exc = get_exception()
warnings.append('duplicate command detected: %s' % cmd) warnings.append('duplicate command detected: %s' % cmd)
for item in conditionals: try:
runner.add_conditional(item) 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.retries = module.params['retries']
runner.interval = module.params['interval'] runner.interval = module.params['interval']

Loading…
Cancel
Save