From 14e68c34eacbe60d792c33bd6e3435c3ab769925 Mon Sep 17 00:00:00 2001 From: Wouter de Bruijn Date: Fri, 27 Feb 2026 13:42:31 +0100 Subject: [PATCH 1/4] =?UTF-8?q?=F0=9F=90=9B=20Changed=20end=20of=20line=20?= =?UTF-8?q?to=20LF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- netbox_zabbix_sync.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/netbox_zabbix_sync.py b/netbox_zabbix_sync.py index 89d2677..9d4ea6e 100755 --- a/netbox_zabbix_sync.py +++ b/netbox_zabbix_sync.py @@ -1,6 +1,6 @@ -#!/usr/bin/env python3 - -from netbox_zabbix_sync.modules.cli import parse_cli - -if __name__ == "__main__": - parse_cli() +#!/usr/bin/env python3 + +from netbox_zabbix_sync.modules.cli import parse_cli + +if __name__ == "__main__": + parse_cli() From 473dd1dcc189cb6d9c312bf0840c4f99a5d089a5 Mon Sep 17 00:00:00 2001 From: Wouter de Bruijn Date: Fri, 27 Feb 2026 13:43:18 +0100 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=90=9B=20Updated=20script=5Fdir=20pat?= =?UTF-8?q?h=20for=20new=20netbox=5Fzabbix=5Fsync=20parent=20folder?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- netbox_zabbix_sync/modules/settings.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/netbox_zabbix_sync/modules/settings.py b/netbox_zabbix_sync/modules/settings.py index f44930a..3d4f86f 100644 --- a/netbox_zabbix_sync/modules/settings.py +++ b/netbox_zabbix_sync/modules/settings.py @@ -114,9 +114,10 @@ def load_env_variable(config_environvar): def load_config_file(config_default, config_file="config.py"): """Returns config from config.py file""" - # Find the script path and config file next to it. - script_dir = path.dirname(path.dirname(path.abspath(__file__))) - config_path = Path(path.join(script_dir, config_file)) + if not config_path or not config_path.exists(): + # Find the script path and config file next to it. + script_dir = path.dirname(path.dirname(path.dirname(path.abspath(__file__)))) + config_path = Path(path.join(script_dir, config_file)) # If the script directory is not found, try the current working directory if not config_path.exists(): From 9da113ac60dd9b636489a0197c82ac0e27dc87b5 Mon Sep 17 00:00:00 2001 From: Wouter de Bruijn Date: Fri, 27 Feb 2026 13:43:56 +0100 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=9A=A7=20Added=20check=20for=20readin?= =?UTF-8?q?g=20config=20file=20from=20netbox-zabbix-sync.py=20as=20root=20?= =?UTF-8?q?dir?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- netbox_zabbix_sync/modules/settings.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/netbox_zabbix_sync/modules/settings.py b/netbox_zabbix_sync/modules/settings.py index 3d4f86f..c0ef5fd 100644 --- a/netbox_zabbix_sync/modules/settings.py +++ b/netbox_zabbix_sync/modules/settings.py @@ -2,6 +2,8 @@ Module for parsing configuration from the top level config.py file """ +from sys import argv + from importlib import util from logging import getLogger from os import environ, path @@ -114,6 +116,17 @@ def load_env_variable(config_environvar): def load_config_file(config_default, config_file="config.py"): """Returns config from config.py file""" + + first_cli_arg = argv[0] if len(argv) > 1 else None + config_path = None + + # If the script was run by the old .py file extension, use path as root of the config file. + if first_cli_arg and first_cli_arg.endswith(".py"): + logger.debug( + "Using legacy script path detection for config file location. Please switch to --config to specify the config file location." + ) + config_path = Path(first_cli_arg).parent / config_file + if not config_path or not config_path.exists(): # Find the script path and config file next to it. script_dir = path.dirname(path.dirname(path.dirname(path.abspath(__file__)))) From 8073cae46abea72e832db1f502b0de2a92e6990d Mon Sep 17 00:00:00 2001 From: Wouter de Bruijn Date: Fri, 27 Feb 2026 15:36:39 +0100 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=94=A5=20Removed=20special=20case=20o?= =?UTF-8?q?ption=20because=20of=20unlikely=20scenario?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- netbox_zabbix_sync/modules/settings.py | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/netbox_zabbix_sync/modules/settings.py b/netbox_zabbix_sync/modules/settings.py index c0ef5fd..78cbecd 100644 --- a/netbox_zabbix_sync/modules/settings.py +++ b/netbox_zabbix_sync/modules/settings.py @@ -2,8 +2,6 @@ Module for parsing configuration from the top level config.py file """ -from sys import argv - from importlib import util from logging import getLogger from os import environ, path @@ -117,20 +115,9 @@ def load_env_variable(config_environvar): def load_config_file(config_default, config_file="config.py"): """Returns config from config.py file""" - first_cli_arg = argv[0] if len(argv) > 1 else None - config_path = None - - # If the script was run by the old .py file extension, use path as root of the config file. - if first_cli_arg and first_cli_arg.endswith(".py"): - logger.debug( - "Using legacy script path detection for config file location. Please switch to --config to specify the config file location." - ) - config_path = Path(first_cli_arg).parent / config_file - - if not config_path or not config_path.exists(): - # Find the script path and config file next to it. - script_dir = path.dirname(path.dirname(path.dirname(path.abspath(__file__)))) - config_path = Path(path.join(script_dir, config_file)) + # Find the script path and config file next to it. + script_dir = path.dirname(path.dirname(path.dirname(path.abspath(__file__)))) + config_path = Path(path.join(script_dir, config_file)) # If the script directory is not found, try the current working directory if not config_path.exists():