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

Configuration fails when IOS XE device is in maintenance mode #716

Open
bl1nkbl1nk opened this issue Jan 4, 2023 · 0 comments · May be fixed by #729
Open

Configuration fails when IOS XE device is in maintenance mode #716

bl1nkbl1nk opened this issue Jan 4, 2023 · 0 comments · May be fixed by #729
Assignees
Labels
feature This issue/PR relates to a feature request. good first issue Good for newcomers

Comments

@bl1nkbl1nk
Copy link

bl1nkbl1nk commented Jan 4, 2023

SUMMARY

When IOS XE Device is in maintenance mode the prompt is not identified correctly and all config fails
This fails using ansible.netcommon.cli_config and cisco.ios.ios_config

maybe issue in regex here?

r"config.*\)#",

ISSUE TYPE
  • Bug Report
COMPONENT NAME

cisco.ios.ios_config

ANSIBLE VERSION
ansible [core 2.14.1]
  python version = 3.10.6 (main, Aug 30 2022, 05:12:36) [Clang 13.1.6 (clang-1316.0.21.2.5)] (/usr/local/opt/[email protected]/bin/python3.10)
  jinja version = 3.1.2
  libyaml = True
COLLECTION VERSION
# /Users/*/.ansible/collections/ansible_collections
Collection               Version
------------------------ -------
ansible.netcommon        4.1.0  
ansible.utils            2.7.0  
ansible.windows          1.9.0  
cisco.ios                4.0.0  
cisco.iosxr              4.0.1  
cisco.nxos               4.0.0  
community.general        6.0.1  
CONFIGURATION
default config
OS / ENVIRONMENT
Switch Ports Model              SW Version        SW Image              Mode
------ ----- -----              ----------        ----------            ----
*    1 65    C9300-48P          17.06.03          CAT9K_IOSXE           INSTALL
STEPS TO REPRODUCE

I just made 2 simple tasks to reproduce, but issue applies to any config

lab-leaf03#start maintenance
Template default will be applied. Do you want to continue?[confirm]

lab-leaf03(maint-mode)#
lab-leaf03(maint-mode)# << Prompt is now changed
lab-leaf03(maint-mod(config)# < Config prompt is this now

After maintenance mode is stopped everything runs as intended

  - name: test stuff
    ignore_errors: yes
    cisco.ios.ios_config:
      config:
        - hostname lab-leaf03

  - name: test stuff
    ansible.netcommon.cli_config: 
      config:
        - hostname lab-leaf03
EXPECTED RESULTS

Able to configure things on device while in maintenance mode

ACTUAL RESULTS

It does not determine correctly which prompt it is in. Instead in enable mode it tries to run end twice to get out. Looks like some regex is not correct somewhere.

TASK [test stuff] **********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
task path: /workspace/ansible-prod/graceful-insert.yml:12
The full traceback is:
  File ".ansible/collections/ansible_collections/cisco/ios/plugins/module_utils/network/ios/ios.py", line 61, in get_capabilities
    capabilities = Connection(module._socket_path).get_capabilities()
  File "/usr/local/lib/python3.10/site-packages/ansible/module_utils/connection.py", line 200, in __rpc__
    raise ConnectionError(to_text(msg, errors='surrogate_then_replace'), code=code)
fatal: [lab-leaf03]: FAILED! => changed=false 
  invocation:
    module_args:
      after: null
      backup: false
      backup_options: null
      before: null
      config:
      - hostname lab-leaf03
      defaults: false
      diff_against: null
      diff_ignore_lines: null
      intended_config: null
      lines: null
      match: line
      multiline_delimiter: '@'
      parents: null
      replace: line
      running_config: '[''hostname lab-leaf03'']'
      save_when: never
      src: null
  msg: |-
    end
    end
      ^
    % Invalid input detected at '^' marker.
  
    lab-leaf03(maint-mode)#
@KB-perByte KB-perByte added the feature This issue/PR relates to a feature request. label Jan 4, 2023
@KB-perByte KB-perByte linked a pull request Feb 1, 2023 that will close this issue
3 tasks
@KB-perByte KB-perByte added the good first issue Good for newcomers label Jun 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This issue/PR relates to a feature request. good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants