|
|
|
@ -127,17 +127,19 @@ options:
|
|
|
|
|
type: bool
|
|
|
|
|
enable_plugin:
|
|
|
|
|
description:
|
|
|
|
|
- This is currently a no-op as dnf5 itself does not implement this feature.
|
|
|
|
|
- I(Plugin) name to enable for the install/update operation.
|
|
|
|
|
The enabled plugin will not persist beyond the transaction.
|
|
|
|
|
- O(disable_plugin) takes precedence in case a plugin is listed in both O(enable_plugin) and O(disable_plugin).
|
|
|
|
|
- Requires python3-libdnf5 5.2.0.0+.
|
|
|
|
|
type: list
|
|
|
|
|
elements: str
|
|
|
|
|
default: []
|
|
|
|
|
disable_plugin:
|
|
|
|
|
description:
|
|
|
|
|
- This is currently a no-op as dnf5 itself does not implement this feature.
|
|
|
|
|
- I(Plugin) name to disable for the install/update operation.
|
|
|
|
|
The disabled plugins will not persist beyond the transaction.
|
|
|
|
|
- O(disable_plugin) takes precedence in case a plugin is listed in both O(enable_plugin) and O(disable_plugin).
|
|
|
|
|
- Requires python3-libdnf5 5.2.0.0+.
|
|
|
|
|
type: list
|
|
|
|
|
default: []
|
|
|
|
|
elements: str
|
|
|
|
@ -434,6 +436,21 @@ class Dnf5Module(YumDnf):
|
|
|
|
|
|
|
|
|
|
self.pkg_mgr_name = "dnf5"
|
|
|
|
|
|
|
|
|
|
def fail_on_non_existing_plugins(self, base):
|
|
|
|
|
# https://github.com/rpm-software-management/dnf5/issues/1460
|
|
|
|
|
plugin_names = [p.get_name() for p in base.get_plugins_info()]
|
|
|
|
|
msg = []
|
|
|
|
|
if enable_unmatched := set(self.enable_plugin).difference(plugin_names):
|
|
|
|
|
msg.append(
|
|
|
|
|
f"No matches were found for the following plugin name patterns while enabling libdnf5 plugins: {', '.join(enable_unmatched)}."
|
|
|
|
|
)
|
|
|
|
|
if disable_unmatched := set(self.disable_plugin).difference(plugin_names):
|
|
|
|
|
msg.append(
|
|
|
|
|
f"No matches were found for the following plugin name patterns while disabling libdnf5 plugins: {', '.join(disable_unmatched)}."
|
|
|
|
|
)
|
|
|
|
|
if msg:
|
|
|
|
|
self.module.fail_json(msg=" ".join(msg))
|
|
|
|
|
|
|
|
|
|
def _ensure_dnf(self):
|
|
|
|
|
locale = get_best_parsable_locale(self.module)
|
|
|
|
|
os.environ["LC_ALL"] = os.environ["LC_MESSAGES"] = locale
|
|
|
|
@ -482,13 +499,6 @@ class Dnf5Module(YumDnf):
|
|
|
|
|
rc=1,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
if self.enable_plugin or self.disable_plugin:
|
|
|
|
|
self.module.fail_json(
|
|
|
|
|
msg="enable_plugin and disable_plugin options are not yet implemented in DNF5",
|
|
|
|
|
failures=[],
|
|
|
|
|
rc=1,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
base = libdnf5.base.Base()
|
|
|
|
|
conf = base.get_config()
|
|
|
|
|
|
|
|
|
@ -531,8 +541,23 @@ class Dnf5Module(YumDnf):
|
|
|
|
|
if self.download_dir:
|
|
|
|
|
conf.destdir = self.download_dir
|
|
|
|
|
|
|
|
|
|
if self.enable_plugin:
|
|
|
|
|
try:
|
|
|
|
|
base.enable_disable_plugins(self.enable_plugin, True)
|
|
|
|
|
except AttributeError:
|
|
|
|
|
self.module.fail_json(msg="'enable_plugin' requires python3-libdnf5 5.2.0.0+")
|
|
|
|
|
|
|
|
|
|
if self.disable_plugin:
|
|
|
|
|
try:
|
|
|
|
|
base.enable_disable_plugins(self.disable_plugin, False)
|
|
|
|
|
except AttributeError:
|
|
|
|
|
self.module.fail_json(msg="'disable_plugin' requires python3-libdnf5 5.2.0.0+")
|
|
|
|
|
|
|
|
|
|
base.setup()
|
|
|
|
|
|
|
|
|
|
# https://github.com/rpm-software-management/dnf5/issues/1460
|
|
|
|
|
self.fail_on_non_existing_plugins(base)
|
|
|
|
|
|
|
|
|
|
log_router = base.get_logger()
|
|
|
|
|
global_logger = libdnf5.logger.GlobalLogger()
|
|
|
|
|
global_logger.set(log_router.get(), libdnf5.logger.Logger.Level_DEBUG)
|
|
|
|
|