mirror of
https://github.com/TheNetworkGuy/netbox-zabbix-sync.git
synced 2025-07-13 15:24:48 -06:00
🚨 Improvement for variable assignment in logging
This commit is contained in:
parent
66d59f2575
commit
132bcc1344
@ -890,16 +890,15 @@ class PhysicalDevice:
|
||||
raise SyncExternalError(msg) from e
|
||||
else:
|
||||
# If no updates are found, Zabbix interface is in-sync
|
||||
e = f"Host {self.name}: interface in-sync."
|
||||
self.logger.debug(e)
|
||||
self.logger.debug("Host %s: interface in-sync.", self.name)
|
||||
else:
|
||||
e = (
|
||||
error_message = (
|
||||
f"Host {self.name} has unsupported interface configuration."
|
||||
f" Host has total of {len(host['interfaces'])} interfaces. "
|
||||
"Manual intervention required."
|
||||
)
|
||||
self.logger.error(e)
|
||||
raise SyncInventoryError(e)
|
||||
self.logger.error(error_message)
|
||||
raise SyncInventoryError(error_message)
|
||||
|
||||
def create_journal_entry(self, severity, message):
|
||||
"""
|
||||
|
@ -244,16 +244,16 @@ def main(arguments):
|
||||
if device.isCluster() and config["clustering"]:
|
||||
# Check if device is primary or secondary
|
||||
if device.promoteMasterDevice():
|
||||
e = f"Device {device.name}: is " f"part of cluster and primary."
|
||||
logger.info(e)
|
||||
logger.info(
|
||||
"Device %s: is part of cluster and primary.", device.name
|
||||
)
|
||||
else:
|
||||
# Device is secondary in cluster.
|
||||
# Don't continue with this device.
|
||||
e = (
|
||||
f"Device {device.name}: is part of cluster "
|
||||
f"but not primary. Skipping this host..."
|
||||
logger.info(
|
||||
"Device %s: is part of cluster but not primary. Skipping this host...",
|
||||
device.name,
|
||||
)
|
||||
logger.info(e)
|
||||
continue
|
||||
# Checks if device is in cleanup state
|
||||
if device.status in config["zabbix_device_removal"]:
|
||||
|
Loading…
Reference in New Issue
Block a user