mirror of
https://github.com/TheNetworkGuy/netbox-zabbix-sync.git
synced 2026-03-21 12:08:39 -06:00
🔥 Removed special case option because of unlikely scenario
This commit is contained in:
@@ -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():
|
||||
|
||||
Reference in New Issue
Block a user