-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
severity: mediumResults in substantial degraded or broken functionality for specfic workflowsResults in substantial degraded or broken functionality for specfic workflowsstatus: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the applicationA confirmed report of unexpected behavior in the application
Description
NetBox version
v3.4.7
Python version
3.11
Steps to Reproduce
- Perform a GET request to get a virtual device context:
curl -X 'GET' \ 'https://netboxtest.netic.dk/api/dcim/virtual-device-contexts/?id=9
Response:
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 9,
"url": "https://netboxtest.netic.dk/api/dcim/devices/9/",
"display": "k7404",
"name": "k7404",
"device": {
"id": 1508,
"url": "https://netboxtest.netic.dk/api/dcim/devices/1508/",
"display": "dc4-1-a7-fg01.inf.example.dk",
"name": "dc4-1-a7-fg01.inf.example.dk"
},
"identifier": null,
"tenant": {
"id": 404,
"url": "https://netboxtest.netic.dk/api/tenancy/tenants/404/",
"display": "EXAMPLE",
"name": "EXAMPLE",
"slug": "example"
},
"primary_ip": null,
"primary_ip4": null,
"primary_ip6": null,
"status": "active",
"description": "",
"comments": "",
"tags": [],
"custom_fields": {},
"created": "2023-06-23T08:10:45.356064Z",
"last_updated": "2023-06-23T08:10:45.356085Z",
"interface_count": 0
}
]
}
It seems to me that the "url" is wrong: "url": "https://netboxtest.netic.dk/api/dcim/devices/9/" as it points at a device, and not the virtual device context endpoint.
This causes a problem when I try to delete the virtual device context, because it tries to lookup the device, and not the vdc:
Traceback (most recent call last):
File "/opt/homebrew/Cellar/[email protected]/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/runpy.py", line 198, in _run_module_as_main
return _run_code(code, main_globals, None,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/runpy.py", line 88, in _run_code
exec(code, run_globals)
File "/Users/pto/.vscode/extensions/ms-python.python-2023.10.1/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/__main__.py", line 39, in <module>
cli.main()
File "/Users/pto/.vscode/extensions/ms-python.python-2023.10.1/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 430, in main
run()
File "/Users/pto/.vscode/extensions/ms-python.python-2023.10.1/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 284, in run_file
runpy.run_path(target, run_name="__main__")
File "/Users/pto/.vscode/extensions/ms-python.python-2023.10.1/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 321, in run_path
return _run_module_code(code, init_globals, run_name,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/pto/.vscode/extensions/ms-python.python-2023.10.1/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 135, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/Users/pto/.vscode/extensions/ms-python.python-2023.10.1/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 124, in _run_code
exec(code, run_globals)
File "/Users/pto/source/network/fortigate_hosted_vdom/NeticNetbox.py", line 114, in <module>
n.virtual_device_context_remove(vdc,firewall)
File "/Users/pto/source/network/fortigate_hosted_vdom/NeticNetbox.py", line 66, in virtual_device_context_remove
vdc.delete()
File "/opt/homebrew/lib/python3.11/site-packages/pynetbox/core/response.py", line 614, in delete
return True if req.delete() else False
^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/pynetbox/core/query.py", line 372, in delete
return self._make_call(verb="delete", data=data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/pynetbox/core/query.py", line 240, in _make_call
raise RequestError(req)
pynetbox.core.query.RequestError: The requested url: https://netboxtest.netic.dk/api/dcim/devices/9/ could not be found.
Expected Behavior
url should point at the virtual device context, and not at the device
Observed Behavior
url points at a dcim device
Metadata
Metadata
Assignees
Labels
severity: mediumResults in substantial degraded or broken functionality for specfic workflowsResults in substantial degraded or broken functionality for specfic workflowsstatus: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the applicationA confirmed report of unexpected behavior in the application