mirror of
https://github.com/TheNetworkGuy/netbox-zabbix-sync.git
synced 2025-07-14 01:41:25 -06:00
Fixed some minor Flake8 errors
This commit is contained in:
parent
e91eecffaa
commit
04a610cf84
@ -157,7 +157,8 @@ class PhysicalDevice():
|
|||||||
if config["inventory_mode"] == "disabled":
|
if config["inventory_mode"] == "disabled":
|
||||||
if config["inventory_sync"]:
|
if config["inventory_sync"]:
|
||||||
self.logger.error(f"Host {self.name}: Unable to map NetBox inventory to Zabbix. "
|
self.logger.error(f"Host {self.name}: Unable to map NetBox inventory to Zabbix. "
|
||||||
"Inventory sync is enabled in config but inventory mode is disabled.")
|
"Inventory sync is enabled in "
|
||||||
|
"config but inventory mode is disabled.")
|
||||||
return True
|
return True
|
||||||
if config["inventory_mode"] == "manual":
|
if config["inventory_mode"] == "manual":
|
||||||
self.inventory_mode = 0
|
self.inventory_mode = 0
|
||||||
@ -409,7 +410,8 @@ class PhysicalDevice():
|
|||||||
# Set Zabbix proxy if defined
|
# Set Zabbix proxy if defined
|
||||||
self.setProxy(proxies)
|
self.setProxy(proxies)
|
||||||
# Set basic data for host creation
|
# Set basic data for host creation
|
||||||
create_data = {"host": self.name,
|
create_data = {
|
||||||
|
"host": self.name,
|
||||||
"name": self.visible_name,
|
"name": self.visible_name,
|
||||||
"status": self.zabbix_state,
|
"status": self.zabbix_state,
|
||||||
"interfaces": interfaces,
|
"interfaces": interfaces,
|
||||||
@ -646,7 +648,7 @@ class PhysicalDevice():
|
|||||||
else:
|
else:
|
||||||
self.logger.warning(f"Host {self.name}: inventory_mode OUT of sync.")
|
self.logger.warning(f"Host {self.name}: inventory_mode OUT of sync.")
|
||||||
self.updateZabbixHost(inventory_mode=str(self.inventory_mode))
|
self.updateZabbixHost(inventory_mode=str(self.inventory_mode))
|
||||||
if config["inventory_sync"] and self.inventory_mode in [0,1]:
|
if config["inventory_sync"] and self.inventory_mode in [0, 1]:
|
||||||
# Check host inventory mapping
|
# Check host inventory mapping
|
||||||
if host['inventory'] == self.inventory:
|
if host['inventory'] == self.inventory:
|
||||||
self.logger.debug(f"Host {self.name}: inventory in-sync.")
|
self.logger.debug(f"Host {self.name}: inventory in-sync.")
|
||||||
@ -664,7 +666,7 @@ class PhysicalDevice():
|
|||||||
if key in host["interfaces"][0]:
|
if key in host["interfaces"][0]:
|
||||||
# If SNMP is used, go through nested dict
|
# If SNMP is used, go through nested dict
|
||||||
# to compare SNMP parameters
|
# to compare SNMP parameters
|
||||||
if isinstance(item,dict) and key == "details":
|
if isinstance(item, dict) and key == "details":
|
||||||
for k, i in item.items():
|
for k, i in item.items():
|
||||||
if k in host["interfaces"][0][key]:
|
if k in host["interfaces"][0][key]:
|
||||||
# Set update if values don't match
|
# Set update if values don't match
|
||||||
|
Loading…
Reference in New Issue
Block a user