fix allocated_draw for inactive PSU #168
No reviewers
Labels
No labels
help wanted
need testing
status: accepted
status: discussing
type: bug
type: documentation
type: duplicate
type: enhancement
type:hardware
type: invalid
type: major feature
type: minor feature
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: DGNum/netbox-agent#168
Loading…
Reference in a new issue
No description provided.
Delete branch "master"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
If you have a setup when one of the power supplies is in passive mode, you may get an error from the API:
DEBUG:urllib3.connectionpool:https://netbox.domain.com:443 "PATCH /api/dcim/power-ports/16/ HTTP/1.1" 400 71
Traceback (most recent call last):
File "/opt/rh/rh-python36/root/usr/bin/netbox_agent", line 11, in
sys.exit(main())
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/netbox_agent/cli.py", line 44, in main
return run(config)
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/netbox_agent/cli.py", line 39, in run
server.netbox_create_or_update(config)
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/netbox_agent/server.py", line 301, in netbox_create_or_update
self.power.report_power_consumption()
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/netbox_agent/power.py", line 123, in report_power_consumption
nb_psu.save()
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/pynetbox/core/response.py", line 391, in save
if req.patch({i: serialized[i] for i in diff}):
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/pynetbox/core/query.py", line 409, in patch
return self._make_call(verb="patch", data=data)
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/pynetbox/core/query.py", line 274, in _make_call
raise RequestError(req)
pynetbox.core.query.RequestError: The request failed with code 400 Bad Request: {'allocated_draw': ['Ensure this value is greater than or equal to 1.']}
thanks for the contribution @z0nker :)