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_network query by ID returns empty data object #441

Closed
mystery-rabbit opened this issue Feb 7, 2023 · 1 comment · Fixed by #442
Closed

meraki_network query by ID returns empty data object #441

mystery-rabbit opened this issue Feb 7, 2023 · 1 comment · Fixed by #442

Comments

@mystery-rabbit
Copy link
Contributor

Where a valid network exists, the following:

  - name: Query one network by ID
    meraki_network:
      auth_key: '{{ auth_key }}'
      state: query
      org_name: '{{test_org_name}}'
      net_id: "{{ net_id}}"
    delegate_to: localhost
    register: net_query_one_id

returns:

TASK [meraki_network : Query one network by ID - debug] ************************
ok: [localhost] => {
    "net_query_one_id": {
        "changed": false,
        "data": false,
        "failed": false,
        "response": "OK (unknown bytes)",
        "status": 200
    }
}

having looked in the code, meraki_network only queries using "net_name". Lines 361-364:

meraki.result["data"] = meraki.get_net(
                    meraki.params["org_name"], meraki.params["net_name"], data=nets
                )

one answer is to modify that to add net_id to the call the meraki.get since there are protections in the code already against them both being set:

 meraki.result["data"] = meraki.get_net(
                    meraki.params["org_name"], net_name=meraki.params["net_name"], data=nets, net_id=meraki.params["net_id"],
                )

I've run a POC for the above and it seems to resolve the issue - happy to submit a PR if you would like.

@kbreit
Copy link
Collaborator

kbreit commented Feb 8, 2023

Yes please submit a PR. Looks like the change is relatively straight forward.

mystery-rabbit added a commit to mystery-rabbit/ansible-meraki that referenced this issue Feb 8, 2023
kbreit pushed a commit that referenced this issue Feb 15, 2023
* Added test coverage for Issue #441 query by net_id

* Enabled query by net_id

* Added changelog fragment to branch
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