Skip to content

Conversation

@jrohel
Copy link
Contributor

@jrohel jrohel commented Dec 1, 2025

Closes: #1555

This Pull Request addresses the limitation where libdnf5 only supported a single configuration path via the pluginconfpath option.

To correctly manage configurations, we require support for multiple directories, specifically:

  • Distribution configuration: /usr/share/dnf5/libdnf.plugins.conf.d
  • System configuration: /etc/dnf/libdnf5-plugins

Configuration and API Changes

  1. New Option plugin_conf_dir: Introduces a new configuration option plugin_conf_dir which accepts and processes a list of directories. The existing pluginconfpath is marked as deprecated but retains its priority in configuration resolution.
  2. Extended Environment Variable: The parsing of the LIBDNF_PLUGINS_CONFIG_DIR environment variable has been updated to also support a list of paths.
  3. New Public API: Adds the libdnf5::plugin::get_config_dirs function. This function makes available the logic previously internal to Base::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

  • Plugin Updates: The actions plugin and the Python plugins loader were modified to utilize this expanded path list, ensuring they now correctly search for their respective configuration subdirectories within all discovered plugin configuration paths.

Note on Naming

** The name plugin_conf_dir was chosen to align with the existing pattern of options representing a list of directories (e.g., varsdir, reposdir), which end in the singular form dir.
Underscores were implemented to align with the pattern observed in longer (three-word) option names that represent directories, such as system_state_dir and transaction_history_dir. However, I note that the naming convention for directories is inconsistent (e.g., observing system_cachedir).

Due to this existing inconsistency, I would appreciate feedback on the chosen name plugin_conf_dir and am willing to consider alternatives.

@jrohel jrohel requested a review from a team as a code owner December 1, 2025 12:51
@jrohel jrohel requested review from kontura and removed request for a team December 1, 2025 12:51
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.
@jrohel jrohel force-pushed the actions_plugin_distrib_conf branch from c7924d8 to d6b6c14 Compare December 4, 2025 13:19
@jrohel jrohel changed the title Support distribution plugin configuration files, support distribution actions plugin configuration files Support for Multiple Plugin Configuration Directories Dec 4, 2025
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.
@jrohel jrohel force-pushed the actions_plugin_distrib_conf branch from d6b6c14 to 68a13b8 Compare December 4, 2025 22:34
@jrohel
Copy link
Contributor Author

jrohel commented Dec 8, 2025

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

@Conan-Kudo
Copy link
Member

Conan-Kudo commented Dec 10, 2025

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Actions plugin is missing a configuration path in /usr

3 participants