From 690a626d0da92624235d6ef75f64c860b21b82ba Mon Sep 17 00:00:00 2001 From: Suan Kan Date: Thu, 2 Nov 2017 17:25:37 +1100 Subject: [PATCH] Issue #32416. Fix exit from configuration mode in case of command failure (#32417) --- lib/ansible/module_utils/ios.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/ansible/module_utils/ios.py b/lib/ansible/module_utils/ios.py index 838b03aca05..3cd8f1a321c 100644 --- a/lib/ansible/module_utils/ios.py +++ b/lib/ansible/module_utils/ios.py @@ -133,6 +133,7 @@ def load_config(module, commands): continue rc, out, err = exec_command(module, command) if rc != 0: + exec_command(module, 'end') module.fail_json(msg=to_text(err, errors='surrogate_then_replace'), command=command, rc=rc) exec_command(module, 'end')