mirror of
https://github.com/TheNetworkGuy/netbox-zabbix-sync.git
synced 2025-12-12 03:19:38 -06:00
corrected linting errors and a minor bug in cf_to_string
This commit is contained in:
parent
bc12064b6a
commit
c27505b927
@ -483,7 +483,7 @@ class PhysicalDevice:
|
|||||||
proxy_name = cf_to_string(self.nb.custom_fields[config[field_config]])
|
proxy_name = cf_to_string(self.nb.custom_fields[config[field_config]])
|
||||||
elif config[field_config] in self.nb.site.custom_fields:
|
elif config[field_config] in self.nb.site.custom_fields:
|
||||||
if self.nb.site.custom_fields[config[field_config]]:
|
if self.nb.site.custom_fields[config[field_config]]:
|
||||||
proxy_name = cf_to_string(self.nb.site.custom_fields[config[field_config]])
|
proxy_name = cf_to_string(self.nb.site.custom_fields[config[field_config]])
|
||||||
|
|
||||||
# Otherwise check if the proxy is configured in NetBox CC
|
# Otherwise check if the proxy is configured in NetBox CC
|
||||||
if (not proxy_name and "zabbix" in self.nb.config_context and
|
if (not proxy_name and "zabbix" in self.nb.config_context and
|
||||||
|
|||||||
@ -55,11 +55,10 @@ def cf_to_string(cf, key="name", logger=None):
|
|||||||
Converts a dict custom fields to string
|
Converts a dict custom fields to string
|
||||||
"""
|
"""
|
||||||
if isinstance(cf, dict):
|
if isinstance(cf, dict):
|
||||||
if key:
|
if key in cf:
|
||||||
return cf[key]
|
return cf[key]
|
||||||
else:
|
logger.error("Conversion of custom field failed, '%s' not found in cf dict.", key)
|
||||||
logger.error("Conversion of custom field failed, '%s' not found in cf dict.", key)
|
return None
|
||||||
return None
|
|
||||||
return cf
|
return cf
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user