Specifying a custom configuration file, command-line settings or environment variables currently fails with different exceptions. There are currently no tests for this.
Specifying environment variables, valid command-line settings or a valid custom configuration file should allow customizing the configuration without any errors.
Errors
Environment variables (note that the first component of the variable name is ignored):
Wrong key 'uri' in {'schema': 1.0, 'auto_migrate_settings': False, 'is_daemon': True, 'pid_file_path': '/tmp/cobbler-tftp.pid', 'cobbler': {'uri': 'http://localhost/cobbler_api', 'username': 'cobbler', 'password': 'cobbler'}, 'tftp': {'address': '0.0.0.0', 'port': 1969, 'retries': 5, 'timeout': 2}, 'logging_conf': '/tmp/logging.conf', 'uri': 'http://test'}
Traceback (most recent call last):
[...]
ValueError: Validation Error: Configuration Parameters could not be validated!
This may be due to an invalid configuration file or path.
Custom config file:
Initializing Cobbler-tftp server...
Traceback (most recent call last):
[...]
File ".../cobbler_tftp/settings/__init__.py", line 208, in load_config_file
files(config_import_path).joinpath(config_file).read_text("utf-8") # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.11/importlib/resources/_common.py", line 22, in files
return from_package(get_package(package))
^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.11/importlib/resources/_common.py", line 53, in get_package
resolved = resolve(package)
^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.11/importlib/resources/_common.py", line 44, in resolve
return cand if isinstance(cand, types.ModuleType) else importlib.import_module(cand)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.11/importlib/__init__.py", line 121, in import_module
raise TypeError(msg.format(name))
TypeError: the 'package' argument is required to perform a relative import for '.tmp'
Command-line settings:
Initializing Cobbler-tftp server...
Traceback (most recent call last):
[...]
File ".../cobbler_tftp/settings/__init__.py", line 285, in load_cli_options
setting_to_update = {parent[key]: setting_to_update}
~~~~~~^^^^^
IndexError: list index out of range
Describe the bug
Specifying a custom configuration file, command-line settings or environment variables currently fails with different exceptions. There are currently no tests for this.
Steps to reproduce
COBBLER_TFTP__COBBLER__URI=http://test cobbler-tftp print-default-config
cobbler-tftp start --no-daemon -c /tmp/cobbler-tftp.yml
(config file must exist)cobbler-tftp start --no-daemon -s cobbler.uri=http://test
Expected behavior
Specifying environment variables, valid command-line settings or a valid custom configuration file should allow customizing the configuration without any errors.
Errors
Environment variables (note that the first component of the variable name is ignored):
Custom config file:
Command-line settings: