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

Crash with KeyError on nxos_config module #57131

Closed
call-tomorrow opened this issue May 29, 2019 · 8 comments · Fixed by #62444
Closed

Crash with KeyError on nxos_config module #57131

call-tomorrow opened this issue May 29, 2019 · 8 comments · Fixed by #62444
Assignees
Labels
affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. cisco Cisco technologies has_pr This issue has an associated PR. module This issue/PR relates to a module. networking Network category nxos Cisco NXOS community support:network This issue/PR relates to code supported by the Ansible Network Team. traceback This issue/PR includes a traceback.

Comments

@call-tomorrow
Copy link

SUMMARY

Playbooks with the presence of nxos_config module parameter 'backup' crashes with KeyError.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

nxos_config

ANSIBLE VERSION
ansible 2.8.0
  config file = /home/testuser/ansible/ansible.cfg
  configured module search path = [u'/home/testuser/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Apr  9 2019, 14:30:50) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]
CONFIGURATION
ANSIBLE_SSH_ARGS(/home/testuser/ansible/ansible.cfg) = -q
DEFAULT_ASK_PASS(/home/testuser/ansible/ansible.cfg) = True
DEFAULT_FORKS(/home/testuser/ansible/ansible.cfg) = 10
DEFAULT_GATHERING(/home/testuser/ansible/ansible.cfg) = explicit
DEFAULT_HOST_LIST(/home/testuser/ansible/ansible.cfg) = [u'/home/testuser/ansible/inventory/hosts']
DEFAULT_ROLES_PATH(env: ANSIBLE_ROLES_PATH) = [u'/home/testuser/ansible/roles']
HOST_KEY_CHECKING(/home/testuser/ansible/ansible.cfg) = False
OS / ENVIRONMENT

Ansible: CentOS Linux release 7.6.1810
Remote: Cisco Nexus9000

STEPS TO REPRODUCE
- name: Add VLAN to port-profile O1
  nxos_config:
        parents:
                - port-profile type ethernet O1
        lines:
                - switchport trunk allowed vlan add {{ item.vlan_id }}
        backup: yes
        provider: "{{ cli }}"
  register: profile_hm
  with_items: "{{ vlans }}"
EXPECTED RESULTS

Clean execution without errors.

ACTUAL RESULTS
The full traceback is:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 110, in run
    item_results = self._run_loop(items)
  File "/usr/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 370, in _run_loop
    res = self._execute(variables=task_vars)
  File "/usr/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 648, in _execute
    result = self._handler.run(task_vars=variables)
  File "/usr/lib/python2.7/site-packages/ansible/plugins/action/nxos.py", line 141, in run
    result = super(ActionModule, self).run(task_vars=task_vars)
  File "/usr/lib/python2.7/site-packages/ansible/plugins/action/network.py", line 51, in run
    self._handle_backup_option(result, task_vars)
  File "/usr/lib/python2.7/site-packages/ansible/plugins/action/network.py", line 106, in _handle_backup_option
    result['backup_path'] = copy_result['dest']
KeyError: 'dest'

fatal: [10.99.10.94]: FAILED! => {
    "msg": "Unexpected failure during module execution.", 
    "stdout": ""
}
@ansibot
Copy link
Contributor

ansibot commented May 29, 2019

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot
Copy link
Contributor

ansibot commented May 29, 2019

@ansibot
Copy link
Contributor

ansibot commented May 29, 2019

@call-tomorrow, 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.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. cisco Cisco technologies module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. networking Network category nxos Cisco NXOS community support:network This issue/PR relates to code supported by the Ansible Network Team. traceback This issue/PR includes a traceback. labels May 29, 2019
@ganeshrn ganeshrn self-assigned this Jun 26, 2019
@ansibot ansibot removed the needs_triage Needs a first human triage before being processed. label Jun 26, 2019
@r1k0
Copy link

r1k0 commented Jul 4, 2019

same exact issue for ios_config using 2.8.0 on RH (upgraded last weekend) no issues with 2.7.5

The full traceback is:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 144, in run
    res = self._execute()
  File "/usr/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 648, in _execute
    result = self._handler.run(task_vars=variables)
  File "/usr/lib/python2.7/site-packages/ansible/plugins/action/ios.py", line 95, in run
    result = super(ActionModule, self).run(task_vars=task_vars)
  File "/usr/lib/python2.7/site-packages/ansible/plugins/action/network.py", line 51, in run
    self._handle_backup_option(result, task_vars)
  File "/usr/lib/python2.7/site-packages/ansible/plugins/action/network.py", line 106, in _handle_backup_option
    result['backup_path'] = copy_result['dest']
KeyError: 'dest'

edit: turns out I had a library module for ios_config.py that was obsolete in addition to having --check alias on ansible-playbook. Adding backup_options to the role and all is good, no more bugs.

@saurav955
Copy link

Had the same issue with ironware_config as well. Removing the check_mode solved it for me.
Thanks r1k0.

@marcosgeorgopoulos
Copy link

We are having the same issue with the iOS_config module, we cannot use check mode with it. looks like 2.8 broke something. regression testing.....?

@james-powis
Copy link
Contributor

This is affecting all of the "network" modules... It is a quick and easy fix and I will get a PR submitted by end of the day to fix.

@Yannis100
Copy link
Contributor

I don't know how to proceed to have this fix backported to stable-2.8 branch the same as #63283 for stable-2.9
@ganeshrn I added a comment in your merge request for stable-2.9

I have different issues in 2.7 and 2.8 that prevents me from doing exactly what I want, and as 2.9 is not an option yet, I'm stuck :(

@ansible ansible locked and limited conversation to collaborators Nov 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. cisco Cisco technologies has_pr This issue has an associated PR. module This issue/PR relates to a module. networking Network category nxos Cisco NXOS community support:network This issue/PR relates to code supported by the Ansible Network Team. traceback This issue/PR includes a traceback.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants