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

cisco.ios.ios_vrf fail when sending status absent on missing VRF #1058

Closed
joakimnyden opened this issue Apr 19, 2024 · 1 comment · Fixed by #1055
Closed

cisco.ios.ios_vrf fail when sending status absent on missing VRF #1058

joakimnyden opened this issue Apr 19, 2024 · 1 comment · Fixed by #1055
Assignees

Comments

@joakimnyden
Copy link

SUMMARY

The cisco.ios.ios_vrf module fail if we try to remove a vrf that does not exists in the config.
Create works, and delete works if the vrf are there.
This problem seem to be introduced in collection version 5.3, I had to go back to version 5.2 to make the module work.

ISSUE TYPE
  • Bug Report
COMPONENT NAME
  - name: delete_vrf - Delete VRF
    cisco.ios.ios_vrf:
      name: "{{ vrf_name }}"
      state: absent
ANSIBLE VERSION
ansible [core 2.15.2]
  config file = None
  configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.9/site-packages/ansible
  ansible collection location = /home/user/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.9.18 (main, Sep 22 2023, 17:58:34) [GCC 8.5.0 20210514 (Red Hat 8.5.0-20)] (/usr/bin/python3)
  jinja version = 3.1.3
  libyaml = True
COLLECTION VERSION
[user]# ansible-galaxy collection list cisco.ios
Collection Version
---------- -------
cisco.ios  8.0.0  
CONFIGURATION
OS / ENVIRONMENT

"ansible_net_iostype": "IOS-XE"
"ansible_net_model": "C8500-12X4QC"
"ansible_net_system": "ios"
"ansible_net_version": "17.06.03a"

STEPS TO REPRODUCE
  1. the vrf should not be configured on the device
  2. call the module cisco.ios.ios_vrf with the state absent
  3. module will fail on collection 8.0.0
  4. If you run the same on collection 5.2.0, this will work.
  - name: delete_vrf - Delete VRF
    cisco.ios.ios_vrf:
      name: "{{ vrf_name }}"
      state: absent
EXPECTED RESULTS

The expected respond would be no change from module and without failure.

ACTUAL RESULTS
<10.10.10.10> Using network group action cisco.ios.ios for cisco.ios.ios_vrf
<NoExistingVrf> ANSIBLE_NETWORK_IMPORT_MODULES: enabled
<NoExistingVrf> ANSIBLE_NETWORK_IMPORT_MODULES: found cisco.ios.ios_vrf  at /usr/share/ansible/collections/ansible_collections/cisco/ios/plugins/modules/ios_vrf.py
<NoExistingVrf> ANSIBLE_NETWORK_IMPORT_MODULES: running cisco.ios.ios_vrf
<NoExistingVrf> ANSIBLE_NETWORK_IMPORT_MODULES: complete
<NoExistingVrf> ANSIBLE_NETWORK_IMPORT_MODULES: Result: {'failed': True, '_ansible_parsed': False, 'module_stdout': '', 'module_stderr': "'NoneType' object is not subscriptable", 'msg': 'MODULE FAILURE\nSee stdout/stderr for the exact error'}
fatal: [NoExistingVrf]: FAILED! => {
    "attempts": 3,
    "changed": false,
    "module_stderr": "'NoneType' object is not subscriptable",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error"
}
@joakimnyden
Copy link
Author

8a9d6c8#diff-ede0fefaa17c7a86bff6a8d6fc55c4fcdbfc36b41a458c0ffdb3ad6597c5fbceR795-R806
This specific code-snippet introduced the issue, it works if I revert this part.

@Ruchip16 Ruchip16 self-assigned this Apr 24, 2024
@Ruchip16 Ruchip16 added bug This issue/PR relates to a bug. and removed bug This issue/PR relates to a bug. labels Apr 24, 2024
@Ruchip16 Ruchip16 linked a pull request May 8, 2024 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants