fix dnf module removal in dnf upstream 4.2.2+ (#54923)
* fix dnf module removal in dnf upstream 4.2.2+ Signed-off-by: Adam Miller <admiller@redhat.com> * Remove extra blank line in changelog fragment.
This commit is contained in:
parent
32218332ee
commit
21d692cace
2 changed files with 11 additions and 2 deletions
3
changelogs/fragments/dnf-4.2.2-module-remove.yaml
Normal file
3
changelogs/fragments/dnf-4.2.2-module-remove.yaml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
bugfixes:
|
||||||
|
- dnf - fix issue with dnf API calls to adapt to changes in upstream dnf version 4.2.2
|
|
@ -600,13 +600,17 @@ class DnfModule(YumDnf):
|
||||||
"""Return a fully configured dnf Base object."""
|
"""Return a fully configured dnf Base object."""
|
||||||
base = dnf.Base()
|
base = dnf.Base()
|
||||||
self._configure_base(base, conf_file, disable_gpg_check, installroot)
|
self._configure_base(base, conf_file, disable_gpg_check, installroot)
|
||||||
self._specify_repositories(base, disablerepo, enablerepo)
|
|
||||||
try:
|
try:
|
||||||
base.init_plugins(set(self.disable_plugin), set(self.enable_plugin))
|
base.init_plugins(set(self.disable_plugin), set(self.enable_plugin))
|
||||||
base.pre_configure_plugins()
|
base.pre_configure_plugins()
|
||||||
|
except AttributeError:
|
||||||
|
pass # older versions of dnf didn't require this and don't have these methods
|
||||||
|
self._specify_repositories(base, disablerepo, enablerepo)
|
||||||
|
try:
|
||||||
base.configure_plugins()
|
base.configure_plugins()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass # older versions of dnf didn't require this and don't have these methods
|
pass # older versions of dnf didn't require this and don't have these methods
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if self.update_cache:
|
if self.update_cache:
|
||||||
try:
|
try:
|
||||||
|
@ -928,6 +932,7 @@ class DnfModule(YumDnf):
|
||||||
if not self._is_module_installed(module):
|
if not self._is_module_installed(module):
|
||||||
response['results'].append("Module {0} installed.".format(module))
|
response['results'].append("Module {0} installed.".format(module))
|
||||||
self.module_base.install([module])
|
self.module_base.install([module])
|
||||||
|
self.module_base.enable([module])
|
||||||
except dnf.exceptions.MarkingErrors as e:
|
except dnf.exceptions.MarkingErrors as e:
|
||||||
failure_response['failures'].append(
|
failure_response['failures'].append(
|
||||||
" ".join(
|
" ".join(
|
||||||
|
@ -1066,8 +1071,9 @@ class DnfModule(YumDnf):
|
||||||
try:
|
try:
|
||||||
if self._is_module_installed(module):
|
if self._is_module_installed(module):
|
||||||
response['results'].append("Module {0} removed.".format(module))
|
response['results'].append("Module {0} removed.".format(module))
|
||||||
self.module_base.disable([module])
|
|
||||||
self.module_base.remove([module])
|
self.module_base.remove([module])
|
||||||
|
self.module_base.disable([module])
|
||||||
|
self.module_base.reset([module])
|
||||||
except dnf.exceptions.MarkingErrors as e:
|
except dnf.exceptions.MarkingErrors as e:
|
||||||
failure_response['failures'].append(
|
failure_response['failures'].append(
|
||||||
" ".join(
|
" ".join(
|
||||||
|
|
Loading…
Reference in a new issue