cobbler_tftp.settings package
Subpackages
Module contents
Build an object containing all cobbler-tftp configuration parameters.
- class cobbler_tftp.settings.Settings(auto_migrate_settings: bool, is_daemon: bool, pid_file_path: Path, uri: str, username: str, password: str | None, password_file: Path | None, token_refresh_interval: int, prefetch_size: int, tftp_addr: str, tftp_port: int, tftp_retries: int, tftp_timeout: int, logging_conf: Path | None, static_fallback_dir: Path | None)
Bases:
objectRepresents the application settings.
By default, these are read from the default
settings.ymlfile that is embedded into the application.- property password: str
Get the password from the password file.
- Returns:
Password string
- class cobbler_tftp.settings.SettingsFactory
Bases:
objectFactory to make it easy building a settings object.
- build_settings(config_path: Path | None, daemon: bool | None = None, enable_automigration: bool | None = None, cli_arguments: List[str] = []) Settings
Build new Settings object using parameters from all sources.
- Parameters:
config_path – Path to the configuration file
cli_arguments – List of all CLI configuration options
- Returns:
Settings object
- load_cli_options(daemon: bool | None = None, enable_automigration: bool | None = None, settings: List[str] = []) Dict[str, float | bool | str | Path | Dict[str, int | str | Path]]
Get parameters and flags from CLI.
These will override the ones taken from the settings file or environment variables and are meant for controlling parameters of the application temporarily.
- Parameters:
daemon – If the application should be run in the background as a daemon or not.
enable_automigration – Whether to enable the automigration or not.
settings – List of custom settings which can be entered manually. Each entry has the format:
<PARENT_YAML_KEY>.<CHILD_YAML_KEY>.<...>.<KEY_NAME>=<VALUE>, where VALUE is parsed as a YAML value.
- Return _settings_dict:
Settings dictionary.
- load_config_file(config_path: Path | None) Dict[str, float | bool | str | Path | Dict[str, int | str | Path]]
Get config file at given path. Load contents and put into settings dict.
- Parameters:
config_path – Path to configuration file. Can be either customized via CLI or default if none
- Return _settings_dict:
Dictionary containing all settings from the settings.yml file
- load_env_variables() Dict[str, float | bool | str | Path | Dict[str, int | str | Path]]
Get environment variables containing relevant settings.
These will override keys taken from the
settings.ymlfile if applicable.