From 3765a08359f3cec438871d562ba5d628e253d8f7 Mon Sep 17 00:00:00 2001 From: Nilashish Chakraborty Date: Thu, 12 Sep 2019 16:25:56 +0530 Subject: [PATCH] Handle cases where normal commit operation throws a prompt (#62132) Signed-off-by: NilashishC (cherry picked from commit f1766457a2fae6c72fe4d7373829ec19f77eabc4) Add changelog for iosxr prompt fix --- changelogs/fragments/62131-iosxr_prompt_fix.yaml | 2 ++ lib/ansible/plugins/cliconf/iosxr.py | 5 +++++ 2 files changed, 7 insertions(+) create mode 100644 changelogs/fragments/62131-iosxr_prompt_fix.yaml diff --git a/changelogs/fragments/62131-iosxr_prompt_fix.yaml b/changelogs/fragments/62131-iosxr_prompt_fix.yaml new file mode 100644 index 00000000000..5fa2873caa2 --- /dev/null +++ b/changelogs/fragments/62131-iosxr_prompt_fix.yaml @@ -0,0 +1,2 @@ +bugfixes: + - iosxr - support cases where a normal commit operation also throws a prompt (https://github.com/ansible/ansible/pull/62132) diff --git a/lib/ansible/plugins/cliconf/iosxr.py b/lib/ansible/plugins/cliconf/iosxr.py index aa20ad0e4ee..16ce9d8e5b3 100644 --- a/lib/ansible/plugins/cliconf/iosxr.py +++ b/lib/ansible/plugins/cliconf/iosxr.py @@ -191,6 +191,11 @@ class Cliconf(CliconfBase): cmd_obj['command'] = 'commit label {0}'.format(label) else: cmd_obj['command'] = 'commit show-error' + # In some cases even a normal commit, i.e., !replace, + # throws a prompt and we need to handle it before + # proceeding further + cmd_obj['prompt'] = '(C|c)onfirm' + cmd_obj['answer'] = 'y' self.send_command(**cmd_obj)