mirror of
https://github.com/TheNetworkGuy/netbox-zabbix-sync.git
synced 2025-07-16 04:02:56 -06:00
Update netbox_zabbix_sync.py
Minor bug fix for float or int zero values in inventory fields
This commit is contained in:
parent
3e638c6f78
commit
e9143eb24c
@ -410,7 +410,10 @@ class NetworkDevice():
|
|||||||
for item in field_list:
|
for item in field_list:
|
||||||
value = value[item] if value else None
|
value = value[item] if value else None
|
||||||
# Check if the result is usable and expected
|
# Check if the result is usable and expected
|
||||||
if value and isinstance(value, int | float | str ):
|
# We want to apply any int or float 0 values,
|
||||||
|
# even if python thinks those are empty.
|
||||||
|
if ((value and isinstance(value, int | float | str )) or
|
||||||
|
(isinstance(value, int | float) and int(value) ==0)):
|
||||||
self.inventory[zbx_inv_field] = str(value)
|
self.inventory[zbx_inv_field] = str(value)
|
||||||
elif not value:
|
elif not value:
|
||||||
# empty value should just be an empty string for API compatibility
|
# empty value should just be an empty string for API compatibility
|
||||||
|
Loading…
Reference in New Issue
Block a user