ansible_modules icon indicating copy to clipboard operation
ansible_modules copied to clipboard

[Bug]: netbox_provider module - deprecated API parameters

Open chuegel opened this issue 1 year ago • 4 comments

Ansible NetBox Collection version

v3.13.0

Ansible version

ansible [core 2.14.3]

NetBox version

v3.4.6

Python version

3.11

Steps to Reproduce

As of v3.13.0 the netbox.netbox.netbox_provider module supports following parameters:

portal_url
noc_contact
admin_contact

but Netbox has removed these in the API. All contact relevant informations are linked via the api/tenancy/contacts/ API endpoint. I guess the above are deprecated

Netbox v.3.4.6 expects following contact parameters:

contact
contact_role
contact_group

which are defined by the netbox.netbox.netbox_contact module.

Expected Behavior

To be able to assign provider contact information

Observed Behavior

Ansible fails with:

failed: [localhost] (item=Colt) => {"ansible_loop_var": "circuit_provider", "changed": false, "circuit_provider": {"account": "FRY211", "admin_contact": "[email protected]", "comments": "Colt Internet Provider", "name": "Colt", "noc_contact": "[email protected]", "portal_url": "https://my.colt.de"}, "msg": "admin_contact does not exist on existing object. Check to make sure valid field."}

chuegel avatar Jun 10 '23 16:06 chuegel

Related to: https://github.com/netbox-community/ansible_modules/issues/965

chuegel avatar Jun 10 '23 16:06 chuegel

What was the last version of the NetBox API where portal_url, noc_contact, admin_contact were supported? We will need to do a version check for the NetBox API version and send those parameters when it's a version of NetBox that has those, and then for versions where they introduced the new API, use that API.

We have an example of that in the Cable API - https://github.com/netbox-community/ansible_modules/blob/devel/plugins/module_utils/netbox_dcim.py#L192

sc68cal avatar Jun 11 '23 18:06 sc68cal

What was the last version of the NetBox API where portal_url, noc_contact, admin_contact were supported? We will need to do a version check for the NetBox API version and send those parameters when it's a version of NetBox that has those, and then for versions where they introduced the new API, use that API.

We have an example of that in the Cable API - https://github.com/netbox-community/ansible_modules/blob/devel/plugins/module_utils/netbox_dcim.py#L192

I think in 3.4.0 there was the breaking change where the portal_url, noc_contact, admin_contact were removed. So last version supported should be 3.3.10 according to the release notes: https://github.com/netbox-community/netbox/releases/tag/v3.4.0

saruter avatar Jun 15 '23 06:06 saruter

OK - since we only officially support the current version and the last two releases, we may not even need to deal with a compatibility layer. Thanks for doing the research @saruter

sc68cal avatar Jun 16 '23 01:06 sc68cal