-
Notifications
You must be signed in to change notification settings - Fork 125
Support for Multiple Plugin Configuration Directories #2537
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Support for Multiple Plugin Configuration Directories #2537
Conversation
This allows read-only access to the main configuration `ConfigMain` object from constant instances of the `Base` class and within `const` methods.
Add libdnf5::plugin::get_config_dirs function that returns plugin configuration directories. This makes previously internal logic from Base::load_plugins() publicly available so plugins don't need to reimplement it.
The function `create_sorted_file_list` is moved from an private header to a new public header file "libdnf5/utils/fs/utils.hpp". This change makes the functionality available for external use, especially within plugins.
The `Actions::parse_actions_file` method has been refactored to utilize two public APIs provided by `libdnf5`: `plugin::get_config_dirs` - To determine the list of all configured directories to search for action files. `utils::fs::create_sorted_file_list` - To retrieve a unique, alphabetically sorted list of action file paths. This change removes the plugin's own limited implementation for directory traversal, ensuring the actions plugin now correctly searches all directories configured in libdnf5 for action definition files.
Python plugin loader has been refactored to utilize two public APIs provided by `libdnf5`: `plugin::get_config_dirs` - To determine the list of all configured directories to search for configuration files. `utils::fs::create_sorted_file_list` - To retrieve a unique, alphabetically sorted list of configuration file paths. This change removes the plugin's own limited implementation for directory traversal, ensuring the python plugins loader now correctly searches all directories configured in libdnf5 for configuration files.
…t of dirs The `plugin::get_config_dirs` function now interprets the environment variable `LIBDNF_PLUGINS_CONFIG_DIR` as a list of directories instead of a single directory path. This change allows users to specify multiple configuration paths via the environment. The OptionStringList parser is used to handle the list format.
c7924d8 to
d6b6c14
Compare
Deprecates the single-directory option "pluginconfpath" in favor of the new list-of-directories option "plugin_conf_dir". The old option was insufficient, as we require support for multiple configuration directories (for distribution-level and system-level configuration files). Corresponding overloaded methods `get_plugin_conf_dir_option` have been added.
d6b6c14 to
68a13b8
Compare
|
The CI test failure is not related to this PR. Two CI tests failed in the file dnf/upgrade-from-vendor.feature. Incidentally, the vendor policies are working correctly according to the test, but the table rows were output in a different order. This means these CI tests need to be fixed so they do not depend on the order of the rows in the table. The goal of the tests was to verify what happens, not the order in which the table rows are listed |
|
I think it makes sense to pluralize the name of the config option, and we probably should go back and fix the rest at some point... |
Closes: #1555
This Pull Request addresses the limitation where libdnf5 only supported a single configuration path via the
pluginconfpathoption.To correctly manage configurations, we require support for multiple directories, specifically:
/usr/share/dnf5/libdnf.plugins.conf.d/etc/dnf/libdnf5-pluginsConfiguration and API Changes
plugin_conf_dir: Introduces a new configuration optionplugin_conf_dirwhich accepts and processes a list of directories. The existingpluginconfpathis marked as deprecated but retains its priority in configuration resolution.LIBDNF_PLUGINS_CONFIG_DIRenvironment variable has been updated to also support a list of paths.libdnf5::plugin::get_config_dirsfunction. This function makes available the logic previously internal toBase::load_plugins, allowing plugins to easily retrieve all relevant configuration directories (including those from the new option and the extended environment variable) without reimplementing the logic.Consequent Changes
Note on Naming
** The name
plugin_conf_dirwas chosen to align with the existing pattern of options representing a list of directories (e.g.,varsdir,reposdir), which end in the singular formdir.Underscores were implemented to align with the pattern observed in longer (three-word) option names that represent directories, such as
system_state_dirandtransaction_history_dir. However, I note that the naming convention for directories is inconsistent (e.g., observingsystem_cachedir).Due to this existing inconsistency, I would appreciate feedback on the chosen name
plugin_conf_dirand am willing to consider alternatives.