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

meraki_admin - KeyError: 'network' #97

Closed
sstone173 opened this issue Jun 17, 2020 · 6 comments · Fixed by #100
Closed

meraki_admin - KeyError: 'network' #97

sstone173 opened this issue Jun 17, 2020 · 6 comments · Fixed by #100
Assignees
Labels
bug Something isn't working

Comments

@sstone173
Copy link

When trying to create an admin with network(s) assigned during creation, I'm receiving the following error:

Traceback (most recent call last):
File "/home/steve/.ansible/tmp/ansible-tmp-1592414226.5026495-265972714452428/AnsiballZ_meraki_admin.py", line 102, in
_ansiballz_main()
File "/home/steve/.ansible/tmp/ansible-tmp-1592414226.5026495-265972714452428/AnsiballZ_meraki_admin.py", line 94, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/home/steve/.ansible/tmp/ansible-tmp-1592414226.5026495-265972714452428/AnsiballZ_meraki_admin.py", line 40, in invoke_module
runpy.run_module(mod_name='ansible.modules.network.meraki.meraki_admin', init_globals=None, run_name='main', alter_sys=True)
File "/usr/lib/python3.8/runpy.py", line 206, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File "/usr/lib/python3.8/runpy.py", line 96, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/usr/lib/python3.8/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/tmp/ansible_meraki_admin_payload_2hzpculp/ansible_meraki_admin_payload.zip/ansible/modules/network/meraki/meraki_admin.py", line 498, in
File "/tmp/ansible_meraki_admin_payload_2hzpculp/ansible_meraki_admin_payload.zip/ansible/modules/network/meraki/meraki_admin.py", line 470, in main
File "/tmp/ansible_meraki_admin_payload_2hzpculp/ansible_meraki_admin_payload.zip/ansible/modules/network/meraki/meraki_admin.py", line 336, in create_admin
File "/tmp/ansible_meraki_admin_payload_2hzpculp/ansible_meraki_admin_payload.zip/ansible/modules/network/meraki/meraki_admin.py", line 316, in network_factory
KeyError: 'network'
fatal: [localhost]: FAILED! => {
"changed": false,
"module_stderr": "Traceback (most recent call last):\n File "/home/steve/.ansible/tmp/ansible-tmp-1592414226.5026495-265972714452428/AnsiballZ_meraki_admin.py", line 102, in \n _ansiballz_main()\n File "/home/steve/.ansible/tmp/ansible-tmp-1592414226.5026495-265972714452428/AnsiballZ_meraki_admin.py", line 94, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File "/home/steve/.ansible/tmp/ansible-tmp-1592414226.5026495-265972714452428/AnsiballZ_meraki_admin.py", line 40, in invoke_module\n runpy.run_module(mod_name='ansible.modules.network.meraki.meraki_admin', init_globals=None, run_name='main', alter_sys=True)\n File "/usr/lib/python3.8/runpy.py", line 206, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File "/usr/lib/python3.8/runpy.py", line 96, in _run_module_code\n _run_code(code, mod_globals, init_globals,\n File "/usr/lib/python3.8/runpy.py", line 86, in _run_code\n exec(code, run_globals)\n File "/tmp/ansible_meraki_admin_payload_2hzpculp/ansible_meraki_admin_payload.zip/ansible/modules/network/meraki/meraki_admin.py", line 498, in \n File "/tmp/ansible_meraki_admin_payload_2hzpculp/ansible_meraki_admin_payload.zip/ansible/modules/network/meraki/meraki_admin.py", line 470, in main\n File "/tmp/ansible_meraki_admin_payload_2hzpculp/ansible_meraki_admin_payload.zip/ansible/modules/network/meraki/meraki_admin.py", line 336, in create_admin\n File "/tmp/ansible_meraki_admin_payload_2hzpculp/ansible_meraki_admin_payload.zip/ansible/modules/network/meraki/meraki_admin.py", line 316, in network_factory\nKeyError: 'network'\n",
"module_stdout": "",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1
}

Playbook:


  • name: Meraki Playbook - Create User
    connection: local
    hosts: localhost

    tasks:

    • name: Create a new administrator with full access to a network
      meraki_admin:
      auth_key:
      org_id:
      state: present
      name: Test User
      org_access: none
      email: testuser@email.com
      networks:
      - id: N_12345XXXXXXXXXXX
      access: full
@kbreit
Copy link
Collaborator

kbreit commented Jun 18, 2020

I didn't see this one come in last night. Give me a little time to test and report back. Thank you for the report!

@kbreit kbreit self-assigned this Jun 18, 2020
@kbreit kbreit added the bug Something isn't working label Jun 18, 2020
@kbreit
Copy link
Collaborator

kbreit commented Jun 19, 2020

@sstone173 I was able to verify this bug and fix it. Please try the code in #100. Let me know if you're not familiar with how to pull these changes.

@sstone173
Copy link
Author

@kbreit I'm pretty new to this, so I'm not familiar with how to pull these changes into my local environment (Ubuntu 20.04 in WSL2), any help would be greatly appreciated :)

@kbreit
Copy link
Collaborator

kbreit commented Jun 20, 2020

@sstone173 I can't speak to WSL2 but my guess is in your home directory in Linux you'll find a .ansible directory. I have ~/.ansible/collections/ansible_collections/cisco/meraki. If you have that, continue drilling down to plugins/modules/ or something like that. In there should be a bunch of Python files which are the actual modules. Copy meraki_admin.py off into a backup and then download https://raw.githubusercontent.com/CiscoDevNet/ansible-meraki/e90798e616b0935133443511eb67eb7823b189fb/plugins/modules/meraki_admin.py over it. That will be the new version to test with. Let me know how this process goes.

@sstone173
Copy link
Author

@kbreit Was able to get the file updated and confirm that it is working now, thanks for all the help!

@kbreit kbreit reopened this Jun 20, 2020
@kbreit
Copy link
Collaborator

kbreit commented Jun 20, 2020

Glad to hear it works. I’ll have a new release this weekend with the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants