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

local_status_page_enabled is not idempotent #201

Closed
petertavenier opened this issue Oct 1, 2020 · 3 comments · Fixed by #203
Closed

local_status_page_enabled is not idempotent #201

petertavenier opened this issue Oct 1, 2020 · 3 comments · Fixed by #203
Assignees
Labels
bug Something isn't working
Projects

Comments

@petertavenier
Copy link

It looks like the local_status_page_enabled and remote_status_page_enabled are not idempotent. so it changes always when you run the playbook API change logs:

Oct 01, 2020 15:11 Peter Tavenier     via API PUT /api/v1/networks/<FILTERED>/settings {"localStatusPageEnabled":false,"remoteStatusPageEnabled":false} {"localStatusPageEnabled":false,"remoteStatusPageEnabled":false}

when using task;

- name: disable local status page
  meraki_network:
    auth_key: "{{ MERAKI_API_KEY }}"
    org_id: "{{ meraki_org_id }}"
    state: present
    local_status_page_enabled: false
    net_name: "{{ item }}"
  with_items: "{{ xlsx_networks }}"
  tags: create_network

I get the message it is changed;

TASK [create_network : disable local status page] ********************************************************************************************************************************************************************************
task path: /home/peter/repositories/ansible/roles/create_network/tasks/main.yml:52
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: peter
<localhost> EXEC /bin/sh -c 'echo ~peter && sleep 0'
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/peter/.ansible/tmp/ansible-tmp-1601564844.9802144-279683828170947 `" && echo ansible-tmp-1601564844.9802144-279683828170947="` echo /home/peter/.ansible/tmp/ansible-tmp-1601564844.9802144-279683828170947 `" ) && sleep 0'
Using module file /home/peter/.ansible/collections/ansible_collections/cisco/meraki/plugins/modules/meraki_network.py
<localhost> PUT /home/peter/.ansible/tmp/ansible-local-1732otvn8_sm/tmppwkkeh82 TO /home/peter/.ansible/tmp/ansible-tmp-1601564844.9802144-279683828170947/AnsiballZ_meraki_network.py
<localhost> EXEC /bin/sh -c 'chmod u+x /home/peter/.ansible/tmp/ansible-tmp-1601564844.9802144-279683828170947/ /home/peter/.ansible/tmp/ansible-tmp-1601564844.9802144-279683828170947/AnsiballZ_meraki_network.py && sleep 0'
<localhost> EXEC /bin/sh -c '/usr/bin/python3 /home/peter/.ansible/tmp/ansible-tmp-1601564844.9802144-279683828170947/AnsiballZ_meraki_network.py && sleep 0'
<localhost> EXEC /bin/sh -c 'rm -f -r /home/peter/.ansible/tmp/ansible-tmp-1601564844.9802144-279683828170947/ > /dev/null 2>&1 && sleep 0'
changed: [localhost] => (item=<FILTERED>) => {
    "ansible_loop_var": "item",
    "changed": true,
    "data": {
        "local_status_page_enabled": false,
        "remote_status_page_enabled": false
    },
    "invocation": {
        "module_args": {
            "auth_key": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "enable_vlans": null,
            "follow_redirects": "all",
            "host": "api.meraki.com",
            "internal_error_retry_time": 60,
            "local_status_page_enabled": false,
            "net_id": null,
            "net_name": "<FILTERED>",
            "org_id": "<FILTERED>",
            "org_name": null,
            "output_format": "snakecase",
            "output_level": "normal",
            "protocol": "https",
            "rate_limit_retry_time": 165,
            "remote_status_page_enabled": null,
            "state": "present",
            "tags": null,
            "timeout": 30,
            "timezone": null,
            "type": null,
            "use_https": true,
            "use_proxy": false,
            "validate_certs": true
        }
    },
    "item": "<FILTERED>",
    "response": "OK (unknown bytes)",
    "status": 200
}

first I thought is was because of the "remote_status_page_enabled": null,

but changing the task to:

- name: disable local status page
  meraki_network:
    auth_key: "{{ MERAKI_API_KEY }}"
    org_id: "{{ meraki_org_id }}"
    state: present
    local_status_page_enabled: false
    remote_status_page_enabled: false
    net_name: "{{ item }}"
  with_items: "{{ xlsx_networks }}"
  tags: create_network 

it also is status "changed";

changed: [localhost] => (item=<FILTERED>) => {
    "ansible_loop_var": "item",
    "changed": true,
    "data": {
        "local_status_page_enabled": false,
        "remote_status_page_enabled": false
    },
    "invocation": {
        "module_args": {
            "auth_key": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "enable_vlans": null,
            "follow_redirects": "all",
            "host": "api.meraki.com",
            "internal_error_retry_time": 60,
            "local_status_page_enabled": false,
            "net_id": null,
            "net_name": "<FILTERED>",
            "org_id": "<FILTERED>",
            "org_name": null,
            "output_format": "snakecase",
            "output_level": "normal",
            "protocol": "https",
            "rate_limit_retry_time": 165,
            "remote_status_page_enabled": false,
            "state": "present",
            "tags": null,
            "timeout": 30,
            "timezone": null,
            "type": null,
            "use_https": true,
            "use_proxy": false,
            "validate_certs": true
        }
    },
    "item": "<FILTERED>",
    "response": "OK (unknown bytes)",
    "status": 200
}
@kbreit
Copy link
Collaborator

kbreit commented Oct 1, 2020

Thanks for reporting this. Give me a little time to investigate the issue and I'll report back.

@kbreit kbreit self-assigned this Oct 1, 2020
@kbreit kbreit added the bug Something isn't working label Oct 1, 2020
@kbreit kbreit added this to To do in Development Oct 1, 2020
@kbreit
Copy link
Collaborator

kbreit commented Oct 1, 2020

@petertavenier Again, thank you for reporting this. I researched this over lunch and was able to confirm the bug and have ideas for a fix.

Gory details - When I query a network to compare the proposed (want) and existing (have) settings, it no longer returns the enabled state of the status pages. When I go to compare it basically says "This property isn't set, gotta update!", even thought it may be set properly. It's most likely I'll need to query the settings and merge it into the query data. This fix will have a significant performance impact because it'll require an additional HTTP request for each execution.

@kbreit
Copy link
Collaborator

kbreit commented Oct 3, 2020

@petertavenier I have #203 set as a pull request. Can you test to see if it fixes your problems?

@kbreit kbreit moved this from To do to In progress in Development Oct 4, 2020
@kbreit kbreit moved this from In progress to Testing in Development Oct 8, 2020
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
Development

Successfully merging a pull request may close this issue.

2 participants