🎨 Minor formatting cleanup

This commit is contained in:
Wouter de Bruijn 2025-10-15 17:27:07 +02:00
parent efb42916fd
commit 8197f41788
No known key found for this signature in database
GPG Key ID: AC71F96733B92BFA
2 changed files with 12 additions and 11 deletions

View File

@ -1,6 +1,7 @@
""" """
Module for parsing configuration from the top level config.py file Module for parsing configuration from the top level config.py file
""" """
from pathlib import Path from pathlib import Path
from importlib import util from importlib import util
from os import environ, path from os import environ, path
@ -17,7 +18,7 @@ DEFAULT_CONFIG = {
"template_cf": "zabbix_template", "template_cf": "zabbix_template",
"device_cf": "zabbix_hostid", "device_cf": "zabbix_hostid",
"proxy_cf": False, "proxy_cf": False,
"proxy_group_cf" : False, "proxy_group_cf": False,
"clustering": False, "clustering": False,
"create_hostgroups": True, "create_hostgroups": True,
"create_journal": False, "create_journal": False,
@ -47,40 +48,40 @@ DEFAULT_CONFIG = {
"serial": "serialno_a", "serial": "serialno_a",
"device_type/model": "type", "device_type/model": "type",
"device_type/manufacturer/name": "vendor", "device_type/manufacturer/name": "vendor",
"oob_ip/address": "oob_ip" "oob_ip/address": "oob_ip",
}, },
"vm_inventory_map": { "vm_inventory_map": {
"status/label": "deployment_status", "status/label": "deployment_status",
"comments": "notes", "comments": "notes",
"name": "name" "name": "name",
}, },
"usermacro_sync": False, "usermacro_sync": False,
"device_usermacro_map": { "device_usermacro_map": {
"serial": "{$HW_SERIAL}", "serial": "{$HW_SERIAL}",
"role/name": "{$DEV_ROLE}", "role/name": "{$DEV_ROLE}",
"url": "{$NB_URL}", "url": "{$NB_URL}",
"id": "{$NB_ID}" "id": "{$NB_ID}",
}, },
"vm_usermacro_map": { "vm_usermacro_map": {
"memory": "{$TOTAL_MEMORY}", "memory": "{$TOTAL_MEMORY}",
"role/name": "{$DEV_ROLE}", "role/name": "{$DEV_ROLE}",
"url": "{$NB_URL}", "url": "{$NB_URL}",
"id": "{$NB_ID}" "id": "{$NB_ID}",
}, },
"tag_sync": False, "tag_sync": False,
"tag_lower": True, "tag_lower": True,
"tag_name": 'NetBox', "tag_name": "NetBox",
"tag_value": "name", "tag_value": "name",
"device_tag_map": { "device_tag_map": {
"site/name": "site", "site/name": "site",
"rack/name": "rack", "rack/name": "rack",
"platform/name": "target" "platform/name": "target",
}, },
"vm_tag_map": { "vm_tag_map": {
"site/name": "site", "site/name": "site",
"cluster/name": "cluster", "cluster/name": "cluster",
"platform/name": "target" "platform/name": "target",
} },
} }

View File

@ -118,8 +118,8 @@ class Hostgroup:
# Check if requested data is available as option for this host # Check if requested data is available as option for this host
if hg_item not in self.format_options: if hg_item not in self.format_options:
if hg_item.startswith(("'", '"')) and hg_item.endswith(("'", '"')): if hg_item.startswith(("'", '"')) and hg_item.endswith(("'", '"')):
hg_item = hg_item.strip("\'") hg_item = hg_item.strip("'")
hg_item = hg_item.strip('\"') hg_item = hg_item.strip('"')
hg_output.append(hg_item) hg_output.append(hg_item)
else: else:
# Check if a custom field exists with this name # Check if a custom field exists with this name