Bug 1694423 - [RFE] disable dnf by default on EL7
Summary: [RFE] disable dnf by default on EL7
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: otopi
Classification: oVirt
Component: Plugins.packagers
Version: 1.8.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ovirt-4.3.5
: 1.8.2
Assignee: Yedidyah Bar David
QA Contact: Pavel Novotny
URL:
Whiteboard:
Depends On:
Blocks: 1711648 1711782 1723938
TreeView+ depends on / blocked
 
Reported: 2019-03-31 10:17 UTC by Yedidyah Bar David
Modified: 2019-07-30 14:08 UTC (History)
4 users (show)

Fixed In Version: otopi-1.8.3
Doc Type: Enhancement
Doc Text:
OTOPI's DNF packager and minidnf is now disabled on EL7 by default, even if dnf is installed. To enforce otopi to try it, add to the relevant tool's (e.g. engine-setup) answer file: PACKAGER/dnfpackagerEnabled=bool:True Or add this to the system environment (e.g. 'export' from the shell): OTOPI_DNF_ENABLE=1 (Former is stronger. If set to False, latter won't have any effect).
Clone Of:
Environment:
Last Closed: 2019-07-30 14:08:35 UTC
oVirt Team: Integration
Embargoed:
sbonazzo: ovirt-4.3?
mtessun: planning_ack+
sbonazzo: devel_ack+
lleistne: testing_ack+


Attachments (Terms of Use)
ovirt-engine-setup logs with DNF installed (65.98 KB, application/zip)
2019-06-20 08:48 UTC, Pavel Novotny
no flags Details


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 99050 0 master MERGED packagers: dnf: Disable dnf by default on el7 2020-12-13 04:26:42 UTC
oVirt gerrit 99107 0 otopi-1.8 MERGED packagers: dnf: Disable dnf by default on el7 2020-12-13 04:26:44 UTC
oVirt gerrit 101155 0 master MERGED core: Disable minidnf by default on el7 2020-12-13 04:26:42 UTC
oVirt gerrit 101204 0 otopi-1.8 MERGED core: Disable minidnf by default on el7 2020-12-13 04:27:12 UTC

Description Yedidyah Bar David 2019-03-31 10:17:43 UTC
Description of problem:

See bug 1655474 comment 7.

We need to disable dnf packager in otopi on el7, at least for now.

Comment 1 Yedidyah Bar David 2019-04-02 07:59:33 UTC
QE: To reproduce/verify, install python2-dnf and dnf on EL7, then try engine-setup. With older versions, you'll see that it tries to use DNF (and may fail). With a patched version, it will not (and should use yum).

Also, with the patched version, add 'PACKAGER/dnfpackagerEnabled=bool:True' to the answerfile, and engine-setup should then try to use dnf.

BTW, instead of engine-setup, you can use a debug plugin I added some time ago to otopi, that can be used to cause it to do package management directly. To do this, install also otopi-debug-plugins, and see [1], e.g.:

otopi ODEBUG/packagesAction=str:install ODEBUG/packages=str:zziplib,zsh

otopi ODEBUG/packagesAction=str:remove ODEBUG/packages=str:zziplib,zsh

[1] https://gerrit.ovirt.org/gitweb?p=otopi.git;a=blob;f=README.debug-plugins

Comment 2 Pavel Novotny 2019-06-19 18:25:19 UTC
FailedQA, it doesn't seem to work on RHEL 7.6 with python2-otopi-1.8.2-1.el7ev.

If dnf and python2-dnf are installed, engine-setup always uses DNF (and fails).
Trying to disable DNF via 'PACKAGER/dnfpackagerEnabled=bool:False' doesn't have any effect.

And vice versa, without dnf & python2-dnf installed, engine-setup always uses YUM,
even if 'PACKAGER/dnfpackagerEnabled=bool:True' is used.

Verification steps:

Answer files used
--~--
# cat use-dnf.ans 
[environment:default]
PACKAGER/dnfpackagerEnabled=bool:True

# cat dont-use-dnf.ans 
[environment:default]
PACKAGER/dnfpackagerEnabled=bool:False
--~--


Running without DNF installed
--~--
# rpm -q {python2-,}dnf
package python2-dnf is not installed
package dnf is not installed

# engine-setup 
[ INFO  ] Stage: Initializing
[ INFO  ] Stage: Environment setup
          Configuration files: ['/etc/ovirt-engine-setup.conf.d/10-packaging-wsp.conf', '/etc/ovirt-engine-setup.conf.d/10-packaging.conf']
          Log file: /var/log/ovirt-engine/setup/ovirt-engine-setup-20190619195824-j6h34h.log
          Version: otopi-1.8.2 (otopi-1.8.2-1.el7ev)
[ INFO  ] Stage: Environment packages setup
...
[ INFO  ] Checking for product updates...
[ INFO  ] No product updates found
...
## checked in ovirt-engine-setup-.log, it uses YUM

# engine-setup --config-append=use-dnf.ans
[ INFO  ] Stage: Initializing
[ INFO  ] Stage: Environment setup
          Configuration files: ['/etc/ovirt-engine-setup.conf.d/10-packaging-wsp.conf', '/etc/ovirt-engine-setup.conf.d/10-packaging.conf', '/root/use-dnf.ans']
...
... same output as above ...
--~--


Running with DNF installed
--~--
# rpm -q {python2-,}dnf
python2-dnf-4.0.9.2-1.el7_6.noarch
dnf-4.0.9.2-1.el7_6.noarch

# engine-setup 
[ INFO  ] Stage: Initializing
[ INFO  ] Stage: Environment setup
          Configuration files: ['/etc/ovirt-engine-setup.conf.d/10-packaging-wsp.conf', '/etc/ovirt-engine-setup.conf.d/10-packaging.conf']
          Log file: /var/log/ovirt-engine/setup/ovirt-engine-setup-20190619200342-xukrte.log
          Version: otopi-1.8.2 (otopi-1.8.2-1.el7ev)
...
[ INFO  ] Checking for product updates...
[ ERROR ] DNF 'Base' object has no attribute '_group_persistor'
[ INFO  ] DNF Performing DNF transaction rollback
[ ERROR ] Failed to execute stage 'Environment customization': 'Base' object has no attribute '_group_persistor'
...

## forcing DNF off
# engine-setup --config-append=dont-use-dnf.ans 
[ INFO  ] Stage: Initializing
[ INFO  ] Stage: Environment setup
          Configuration files: ['/etc/ovirt-engine-setup.conf.d/10-packaging-wsp.conf', '/etc/ovirt-engine-setup.conf.d/10-packaging.conf', '/root/dont-use-dnf.ans']
          Log file: /var/log/ovirt-engine/setup/ovirt-engine-setup-20190619200524-9zbs7b.log
          Version: otopi-1.8.2 (otopi-1.8.2-1.el7ev)
...
[ INFO  ] Checking for product updates...
[ ERROR ] DNF 'Base' object has no attribute '_group_persistor'
[ INFO  ] DNF Performing DNF transaction rollback
[ ERROR ] Failed to execute stage 'Environment customization': 'Base' object has no attribute '_group_persistor'
...
--~--

Comment 3 Yedidyah Bar David 2019-06-20 06:29:07 UTC
(In reply to Pavel Novotny from comment #2)
> FailedQA, it doesn't seem to work on RHEL 7.6 with
> python2-otopi-1.8.2-1.el7ev.
> 
> If dnf and python2-dnf are installed, engine-setup always uses DNF (and
> fails).
> Trying to disable DNF via 'PACKAGER/dnfpackagerEnabled=bool:False' doesn't
> have any effect.

Weird.

> 
> And vice versa, without dnf & python2-dnf installed, engine-setup always
> uses YUM,
> even if 'PACKAGER/dnfpackagerEnabled=bool:True' is used.

That's by design. It won't try to install dnf for you, only try using it if already installed.

> 
> Verification steps:
> 
> Answer files used
> --~--
> # cat use-dnf.ans 
> [environment:default]
> PACKAGER/dnfpackagerEnabled=bool:True
> 
> # cat dont-use-dnf.ans 
> [environment:default]
> PACKAGER/dnfpackagerEnabled=bool:False
> --~--
> 
> 
> Running without DNF installed
> --~--
> # rpm -q {python2-,}dnf
> package python2-dnf is not installed
> package dnf is not installed
> 
> # engine-setup 
> [ INFO  ] Stage: Initializing
> [ INFO  ] Stage: Environment setup
>           Configuration files:
> ['/etc/ovirt-engine-setup.conf.d/10-packaging-wsp.conf',
> '/etc/ovirt-engine-setup.conf.d/10-packaging.conf']
>           Log file:
> /var/log/ovirt-engine/setup/ovirt-engine-setup-20190619195824-j6h34h.log
>           Version: otopi-1.8.2 (otopi-1.8.2-1.el7ev)
> [ INFO  ] Stage: Environment packages setup
> ...
> [ INFO  ] Checking for product updates...
> [ INFO  ] No product updates found
> ...
> ## checked in ovirt-engine-setup-.log, it uses YUM
> 
> # engine-setup --config-append=use-dnf.ans
> [ INFO  ] Stage: Initializing
> [ INFO  ] Stage: Environment setup
>           Configuration files:
> ['/etc/ovirt-engine-setup.conf.d/10-packaging-wsp.conf',
> '/etc/ovirt-engine-setup.conf.d/10-packaging.conf', '/root/use-dnf.ans']
> ...
> ... same output as above ...
> --~--

OK.

> 
> 
> Running with DNF installed
> --~--
> # rpm -q {python2-,}dnf
> python2-dnf-4.0.9.2-1.el7_6.noarch
> dnf-4.0.9.2-1.el7_6.noarch
> 
> # engine-setup 
> [ INFO  ] Stage: Initializing
> [ INFO  ] Stage: Environment setup
>           Configuration files:
> ['/etc/ovirt-engine-setup.conf.d/10-packaging-wsp.conf',
> '/etc/ovirt-engine-setup.conf.d/10-packaging.conf']
>           Log file:
> /var/log/ovirt-engine/setup/ovirt-engine-setup-20190619200342-xukrte.log
>           Version: otopi-1.8.2 (otopi-1.8.2-1.el7ev)
> ...
> [ INFO  ] Checking for product updates...
> [ ERROR ] DNF 'Base' object has no attribute '_group_persistor'
> [ INFO  ] DNF Performing DNF transaction rollback
> [ ERROR ] Failed to execute stage 'Environment customization': 'Base' object
> has no attribute '_group_persistor'
> ...
> 
> ## forcing DNF off
> # engine-setup --config-append=dont-use-dnf.ans 
> [ INFO  ] Stage: Initializing
> [ INFO  ] Stage: Environment setup
>           Configuration files:
> ['/etc/ovirt-engine-setup.conf.d/10-packaging-wsp.conf',
> '/etc/ovirt-engine-setup.conf.d/10-packaging.conf', '/root/dont-use-dnf.ans']
>           Log file:
> /var/log/ovirt-engine/setup/ovirt-engine-setup-20190619200524-9zbs7b.log
>           Version: otopi-1.8.2 (otopi-1.8.2-1.el7ev)
> ...
> [ INFO  ] Checking for product updates...
> [ ERROR ] DNF 'Base' object has no attribute '_group_persistor'
> [ INFO  ] DNF Performing DNF transaction rollback
> [ ERROR ] Failed to execute stage 'Environment customization': 'Base' object
> has no attribute '_group_persistor'
> ...
> --~--

Please attach setup logs of both of these runs. Thanks!

Comment 4 Pavel Novotny 2019-06-20 08:48:01 UTC
Created attachment 1582577 [details]
ovirt-engine-setup logs with DNF installed

Sure.

Comment 5 Yedidyah Bar David 2019-06-20 09:25:17 UTC
OK, I see. It failed for you in code specific to engine-setup, so the latter part of comment 1 can still be used to verify current bug (on otopi). However, since it's too late for 4.3.4, I am keeping bug on assigned, and would consider patching only otopi also for the specific case of engine-setup, although this seems like it will be a bit ugly.

Comment 6 Yedidyah Bar David 2019-06-25 21:17:37 UTC
QE: In addition to comment 1:

It's now possible to force otopi to try dnf also by setting env var OTOPI_DNF_ENABLE to 1, e.g.:

OTOPI_DNF_ENABLE=1 otopi ODEBUG/packagesAction=str:install ODEBUG/packages=str:zziplib,zsh

With tools that do not have answer files, this is your only option. This applies to ovirt-engine-upgrade-check.

With tools that do have answer files, you can pass either. If you pass both, otopi env (=answer file) wins over system env. Meaning, if you set in answer file to False, setting '1' in system env should not have any effect.

This was needed because some tools (ovirt-engine-upgrade-check and engine-setup) try to use minidnf directly, not (only) via the dnf packager plugin. minidnf is a simple python module, not an otopi plugin, so has no access to otopi env.

Comment 7 Pavel Novotny 2019-07-24 09:07:53 UTC
Verified in python2-otopi-1.8.3-1.el7ev.noarch

Installing dnf and running engine-setup will still use YUM by default.

Running `OTOPI_DNF_ENABLE=1 otopi ODEBUG/packagesAction=str:install ODEBUG/packages=str:zziplib,zsh` uses DNF.
Running `OTOPI_DNF_ENABLE=1 engine-setup` uses also DNF.

Comment 8 Sandro Bonazzola 2019-07-30 14:08:35 UTC
This bugzilla is included in oVirt 4.3.5 release, published on July 30th 2019.

Since the problem described in this bug report should be
resolved in oVirt 4.3.5 release, it has been closed with a resolution of CURRENT RELEASE.

If the solution does not work for you, please open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.