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)