diff --git a/network/junos/junos_command.py b/network/junos/junos_command.py index fb80f0acad2..f370ace3d8a 100644 --- a/network/junos/junos_command.py +++ b/network/junos/junos_command.py @@ -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']