Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport 2.9: Handle cases where normal commit operation throws a prompt (#62132) #62191

Merged
merged 1 commit into from
Sep 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions 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)
5 changes: 5 additions & 0 deletions lib/ansible/plugins/cliconf/iosxr.py
Expand Up @@ -191,6 +191,11 @@ def commit(self, comment=None, label=None, replace=None):
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'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This API is odd... it seems to be, if I encounter this prompt, give it the answer. But it doesn't require the prompt to occur. Since that's what is desired here, there's no bug and I'll merge it.... Just commenting because that's not the standard way to write an API and it took me a bit to analyze the code to be sure that it was actually doing this.


self.send_command(**cmd_obj)

Expand Down