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

interface and assign it to parent LAG] error #106

Closed
tkspuk opened this issue Feb 20, 2020 · 4 comments · Fixed by #109
Closed

interface and assign it to parent LAG] error #106

tkspuk opened this issue Feb 20, 2020 · 4 comments · Fixed by #109
Labels
bug Something isn't working PR Submitted

Comments

@tkspuk
Copy link

tkspuk commented Feb 20, 2020

ISSUE TYPE
  • Bug Report
SUMMARY
STEPS TO REPRODUCE
      netbox_device_interface:
        netbox_url: "http://localhost:32775"
        netbox_token: "64d95bd488a66f3b745ed175df8d0ce089af5b0b"
        data:
          device: test100
          name: GigabitEthernet1
          enabled: false
          form_factor: 1000Base-t (1GE)
          lag:
            name: port-channel1
          mtu: 1600
          mgmt_only: false
          mode: Access
        state: present
EXPECTED RESULTS
PLAY RECAP *************************************************************************************
localhost   : ok=1    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
ACTUAL RESULTS
TASK [Create interface and assign it to parent LAG] ****************************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "{\"type\":[\"Select a valid choice. 200 is not one of the available choices.\"]}"}
Ansible -vvv results
ansible-playbook 2.9.5
  config file = None
  configured module search path = ['/Users/mtlocus/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.7/site-packages/ansible
  executable location = /usr/local/bin/ansible-playbook
  python version = 3.7.3 (default, Mar 27 2019, 09:23:15) [Clang 10.0.1 (clang-1001.0.46.3)]
No config file found; using defaults
host_list declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
script declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
yaml declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
ini declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
toml declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

PLAYBOOK: test1.yml ************************************************************************************************************************************************************
1 plays in test1.yml

PLAY [Test Netbox modules] *****************************************************************************************************************************************************
META: ran handlers

TASK [Create interface and assign it to parent LAG] ****************************************************************************************************************************
task path: /Users/mtlocus/devnet/git/ansible_modules/tests/integration/test1.yml:9
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: mtlocus
<127.0.0.1> EXEC /bin/sh -c 'echo ~mtlocus && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /Users/mtlocus/.ansible/tmp/ansible-tmp-1582210756.625417-86552937312337 `" && echo ansible-tmp-1582210756.625417-86552937312337="` echo /Users/mtlocus/.ansible/tmp/ansible-tmp-1582210756.625417-86552937312337 `" ) && sleep 0'
Using module file /Users/mtlocus/.ansible/collections/ansible_collections/netbox_community/ansible_modules/plugins/modules/netbox_device_interface.py
<127.0.0.1> PUT /Users/mtlocus/.ansible/tmp/ansible-local-36370grvis7ap/tmpct3ct4si TO /Users/mtlocus/.ansible/tmp/ansible-tmp-1582210756.625417-86552937312337/AnsiballZ_netbox_device_interface.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /Users/mtlocus/.ansible/tmp/ansible-tmp-1582210756.625417-86552937312337/ /Users/mtlocus/.ansible/tmp/ansible-tmp-1582210756.625417-86552937312337/AnsiballZ_netbox_device_interface.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/usr/local/opt/python/bin/python3.7 /Users/mtlocus/.ansible/tmp/ansible-tmp-1582210756.625417-86552937312337/AnsiballZ_netbox_device_interface.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /Users/mtlocus/.ansible/tmp/ansible-tmp-1582210756.625417-86552937312337/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
  File "/var/folders/rv/3qvskvh554n0dc38n7zjczx80000gp/T/ansible_netbox_device_interface_payload_ywsypkfn/ansible_netbox_device_interface_payload.zip/ansible_collections/netbox_community/ansible_modules/plugins/module_utils/netbox_utils.py", line 355, in _nb_endpoint_get
    response = nb_endpoint.get(**query_params)
  File "/usr/local/lib/python3.7/site-packages/pynetbox/core/endpoint.py", line 138, in get
    filter_lookup = self.filter(**kwargs)
  File "/usr/local/lib/python3.7/site-packages/pynetbox/core/endpoint.py", line 225, in filter
    ret = [self._response_loader(i) for i in req.get()]
  File "/usr/local/lib/python3.7/site-packages/pynetbox/core/query.py", line 300, in get
    return req_all()
  File "/usr/local/lib/python3.7/site-packages/pynetbox/core/query.py", line 279, in req_all
    req = self._make_call(add_params=add_params)
  File "/usr/local/lib/python3.7/site-packages/pynetbox/core/query.py", line 263, in _make_call
    raise RequestError(req)
fatal: [localhost]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "data": {
                "description": null,
                "device": "test100",
                "enabled": false,
                "form_factor": "1000Base-t (1GE)",
                "lag": {
                    "name": "port-channel1"
                },
                "mac_address": null,
                "mgmt_only": false,
                "mode": "Access",
                "mtu": 1600,
                "name": "GigabitEthernet1",
                "tagged_vlans": null,
                "tags": null,
                "untagged_vlan": null
            },
            "netbox_token": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "netbox_url": "http://localhost:32775",
            "state": "present",
            "validate_certs": true
        }
    },
    "msg": "{\"type\":[\"Select a valid choice. 200 is not one of the available choices.\"]}"
}

PLAY RECAP *********************************************************************************************************************************************************************
localhost                  : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0
@FragmentedPacket
Copy link
Contributor

Are you running Netbox 2.7?

I think this is because I have it statically set within a function to set the search type of lag to 200.

@tkspuk
Copy link
Author

tkspuk commented Feb 20, 2020

@FragmentedPacket Yes,It's latest v2.7.6, I've tried, lab: 'port-channel1',that is worked,But when input dict. still failed. does this need to be fixed or other

@FragmentedPacket
Copy link
Contributor

Yes it still needs to be fixed. Please keep this issue opened and I will get this fixed tonight.

Thanks for reporting the issue!

@FragmentedPacket
Copy link
Contributor

If you have time, can you verify PR #109 fixes the issue? I've tested myself, but I haven't switched the travis tests over to Netbox 2.7 yet. If I don't hear back from you, I will probably get this merged this weekend anways.

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