You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I use nb.ipam.prefixes.update, no update happens Expected behavior:
I would expect the http patch data to update and the server to respond with the updated data.
I excpect the server to respond with the changed data Steps to reproduce:
Below code, is a simple example of just trying to update a description
Related code:
In the below code I am just trying to change the description. It doesn't update using the netbox-python module
when I re-write it to use the requests module it does update as expected
#!/usr/bin/env python3
import json
import requests
from netbox_python import NetBoxClient, Result
nb = NetBoxClient(
base_url="https://netbox.domain.com/", token="<YOUR_TOKEN_HERE>"
)
Bug Report
NetBox Python version:
0.1.6
Current behavior:
no update happens
When I use nb.ipam.prefixes.update, no update happens
Expected behavior:
I would expect the http patch data to update and the server to respond with the updated data.
I excpect the server to respond with the changed data
Steps to reproduce:
Below code, is a simple example of just trying to update a description
Related code:
In the below code I am just trying to change the description. It doesn't update using the netbox-python module
when I re-write it to use the requests module it does update as expected
#!/usr/bin/env python3
import json
import requests
from netbox_python import NetBoxClient, Result
nb = NetBoxClient(
base_url="https://netbox.domain.com/", token="<YOUR_TOKEN_HERE>"
)
def update_prefix():
prefix_id = 682
data = {"id": 682, "prefix": "192.168.71.0/25", "description": "LAB Management", "site": {"id": 279}, "tenant": {"id": 2}, "vlan": {"id": 637}}
ret = nb.ipam.prefixes.update(prefix_id, json=data)
print(f"status code: {ret.response.status_code}")
print("netbox-python module prefixes update:")
print(json.dumps(ret.data, indent=2))
if name == "main":
update_prefix()
output below:
status code: 200
netbox-python module prefixes update:
{
"id": 682,
"url": "http://netbox.domain.com/api/ipam/prefixes/682/",
"family": {
"value": 4,
"label": "IPv4"
},
"prefix": "192.168.71.0/25",
"site": {
"id": 279,
"url": "http://netbox.domain.com/api/dcim/sites/279/",
"name": "LAB",
"slug": "lab"
},
"vrf": null,
"tenant": {
"id": 2,
"url": "http://netbox.domain.com/api/tenancy/tenants/2/",
"name": "SCA",
"slug": "sca"
},
"vlan": {
"id": 637,
"url": "http://netbox.domain.com/api/ipam/vlans/637/",
"vid": 100,
"name": "Management",
"display_name": "Management (100)"
},
"status": {
"value": "active",
"label": "Active"
},
"role": null,
"is_pool": false,
"description": "BAD BAD BAD Description",
"tags": [],
"custom_fields": {
"ActiveDirectorySite": false
},
"created": "2023-09-26",
"last_updated": "2023-09-26T13:10:43.854351Z"
}
status code: 200
requests module prefixes update:
{
"id": 682,
"url": "http://netbox.domain.com/api/ipam/prefixes/682/",
"family": {
"value": 4,
"label": "IPv4"
},
"prefix": "192.168.71.0/25",
"site": {
"id": 279,
"url": "http://netbox.domain.com/api/dcim/sites/279/",
"name": "LAB",
"slug": "lab"
},
"vrf": null,
"tenant": {
"id": 2,
"url": "http://netbox.domain.com/api/tenancy/tenants/2/",
"name": "SCA",
"slug": "sca"
},
"vlan": {
"id": 637,
"url": "http://netbox.domain.com/api/ipam/vlans/637/",
"vid": 100,
"name": "Management",
"display_name": "Management (100)"
},
"status": {
"value": "active",
"label": "Active"
},
"role": null,
"is_pool": false,
"description": "LAB Management",
"tags": [],
"custom_fields": {
"ActiveDirectorySite": false
},
"created": "2023-09-26",
"last_updated": "2023-09-26T13:10:44.357695Z"
}
Other information:
The text was updated successfully, but these errors were encountered: