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

ios_config: Handle confirmation prompt after version change (#57745) #57749

Closed
wants to merge 2 commits into from

Conversation

jrunu
Copy link

@jrunu jrunu commented Jun 12, 2019

SUMMARY

Handle "Warning different version" prompt when saving config to Non-Volatile RAM on Cisco iOS devices.
Fixes #57745

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

ios_config

ADDITIONAL INFORMATION

First time contributer to ansible. Has no idea what he's doing.

@ansibot
Copy link
Contributor

ansibot commented Jun 12, 2019

@ansibot
Copy link
Contributor

ansibot commented Jun 12, 2019

@jrunu, just so you are aware we have a dedicated Working Group for network.
You can find other people interested in this in #ansible-network on Freenode IRC
For more information about communities, meetings and agendas see https://github.com/ansible/community

click here for bot help

@ansibot ansibot added affects_2.9 This issue/PR affects Ansible v2.9 bug This issue/PR relates to a bug. cisco Cisco technologies core_review In order to be merged, this PR must follow the core review workflow. ios Cisco IOS community module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. networking Network category new_contributor This PR is the first contribution by a new community member. small_patch support:network This issue/PR relates to code supported by the Ansible Network Team. labels Jun 12, 2019
@ansibot
Copy link
Contributor

ansibot commented Jun 12, 2019

The test ansible-test sanity --test pylint [explain] failed with 3 errors:

lib/ansible/modules/network/ios/ios_config.py:396:0: anomalous-backslash-in-string Anomalous backslash in string: '\?'. String constant might be missing an r prefix.
lib/ansible/modules/network/ios/ios_config.py:396:0: anomalous-backslash-in-string Anomalous backslash in string: '\['. String constant might be missing an r prefix.
lib/ansible/modules/network/ios/ios_config.py:396:0: anomalous-backslash-in-string Anomalous backslash in string: '\]'. String constant might be missing an r prefix.

The test ansible-test sanity --test ansible-doc --python 3.8 [explain] failed with the error:

Output on stderr from ansible-doc is considered an error.

Command "ansible-doc -t module ios_config" returned exit status 0.
>>> Standard Error
<unknown>:396: SyntaxWarning: invalid escape sequence \?

The test ansible-test sanity --test import --python 3.8 [explain] failed with 1 error:

lib/ansible/modules/network/ios/ios_config.py:396:0: SyntaxWarning: invalid escape sequence \?

The test ansible-test sanity --test pep8 [explain] failed with 4 errors:

lib/ansible/modules/network/ios/ios_config.py:396:147: W605 invalid escape sequence '\?'
lib/ansible/modules/network/ios/ios_config.py:396:149: W605 invalid escape sequence '\['
lib/ansible/modules/network/ios/ios_config.py:396:158: W605 invalid escape sequence '\]'
lib/ansible/modules/network/ios/ios_config.py:396:161: E501 line too long (174 > 160 characters)

click here for bot help

@ansibot ansibot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed core_review In order to be merged, this PR must follow the core review workflow. labels Jun 12, 2019
@ansible-zuul
Copy link

ansible-zuul bot commented Jun 12, 2019

Build succeeded (third-party-check pipeline).

@pabelanger
Copy link
Contributor

Do you have a way to reproduce this, on an already configured ios device? If so, we can write a test here and add it to our integration test suite.

@ansibot ansibot removed the needs_triage Needs a first human triage before being processed. label Jun 12, 2019
@jrunu
Copy link
Author

jrunu commented Jun 13, 2019

I played a bit in the lab and wasn't able to trigger this without performing an actual upgrade i.e. booting from one image into another. (I had ideas about messing with the version in the startup-config and reloading). So basically:

  1. Set the older to boot and load into it
  2. Set the newer version to boot
  3. Write config
  4. Reload
  5. Write config -> Warning prompt

The versions in my particular case were 15.4-M3(M8) to 15.6-M3(M6a). My resident cisco expert told me that this is an edge case. This warning isn't trigger with all minor release (not bugfix releases) upgrades, which I originally thought. There was at some point a breaking change in the configuration syntax. This is what triggers the warning. However I can't tell you the specific release. And for completeness sake, this was performed on a C886 device.

@pabelanger
Copy link
Contributor

Thanks for the detailed write up, that is what I was expecting. Today we don't do in-place upgrades of ios appliances for testing (in theory is something we could do). Lets wait until others review, to see if they have ideas how we could test.

@ganeshrn ganeshrn requested a review from Qalthos June 19, 2019 14:36
@samdoran samdoran added the ci_verified Changes made in this PR are causing tests to fail. label Jun 21, 2019
@ansibot
Copy link
Contributor

ansibot commented Jun 21, 2019

@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Jun 21, 2019
@Qalthos
Copy link
Contributor

Qalthos commented Dec 11, 2019

recheck

run_commands(module, 'copy running-config startup-config\r')
try:
get_connection(module).send_command(command='copy running-config startup-config\r',
prompt='Overwrite the previous NVRAM configuration?[confirm]',
Copy link
Contributor

Choose a reason for hiding this comment

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

You almost had it right the first time, but you needed to use a raw string instead (or double escape, but this is why we have raw strings)

Suggested change
prompt='Overwrite the previous NVRAM configuration?[confirm]',
prompt=r'Overwrite the previous NVRAM configuration\?\[confirm\]',

@ansibot ansibot removed the ci_verified Changes made in this PR are causing tests to fail. label Dec 11, 2019
@ansibot ansibot removed the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Dec 11, 2019
@ansible-zuul
Copy link

ansible-zuul bot commented Dec 11, 2019

Build succeeded (third-party-check pipeline).

@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Dec 19, 2019
@mattclay mattclay added the ci_verified Changes made in this PR are causing tests to fail. label Jan 9, 2020
@ansibot ansibot added the needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html label Mar 29, 2020
@ansibot ansibot added collection Related to Ansible Collections work collection:cisco.ios needs_collection_redirect https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md support:community This issue/PR relates to code supported by the Ansible community. and removed support:network This issue/PR relates to code supported by the Ansible Network Team. labels Apr 29, 2020
@danielmellado
Copy link
Contributor

Thank you very much for your interest in Ansible. This plugin is no longer maintained in this repository and has been migrated to https://github.com/ansible-collections/cisco.ios
Please re-submit this PR in the above repository.
If you have further questions please stop by IRC or the mailing list:

IRC: #ansible-network on irc.freenode.net
mailing list: https://groups.google.com/forum/#!forum/ansible-project

@ansible ansible locked and limited conversation to collaborators Jun 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.9 This issue/PR affects Ansible v2.9 bug This issue/PR relates to a bug. ci_verified Changes made in this PR are causing tests to fail. cisco Cisco technologies collection:cisco.ios collection Related to Ansible Collections work ios Cisco IOS community module This issue/PR relates to a module. needs_collection_redirect https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. networking Network category new_contributor This PR is the first contribution by a new community member. small_patch stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. support:community This issue/PR relates to code supported by the Ansible community.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ios_config does not handle confirm prompt when saving first time after iOS version change
7 participants