Bug 1080331 - dnf group list fail to run with noroot plugin
dnf group list fail to run with noroot plugin
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: dnf (Show other bugs)
20
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Ales Kozumplik
Fedora Extras Quality Assurance
:
Depends On: 1062889
Blocks:
  Show dependency treegraph
 
Reported: 2014-03-25 03:50 EDT by Tim Lauridsen
Modified: 2014-09-30 19:42 EDT (History)
4 users (show)

See Also:
Fixed In Version: dnf-plugins-core-0.0.8-2.fc20
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-05-31 19:59:03 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
fix for group install (1.89 KB, patch)
2014-04-08 01:25 EDT, Tim Lauridsen
no flags Details | Diff
Better patch (1.89 KB, patch)
2014-04-08 01:47 EDT, Tim Lauridsen
no flags Details | Diff
Better patch (wrong checkout) (1.85 KB, patch)
2014-04-08 01:50 EDT, Tim Lauridsen
no flags Details | Diff
fix for group install (3.05 KB, patch)
2014-04-08 02:31 EDT, Tim Lauridsen
no flags Details | Diff

  None (edit)
Description Tim Lauridsen 2014-03-25 03:50:09 EDT
Description of problem:
if dnf-plugins-core is install, it is not possible to run 
dnf group list
dnf group info

as non root


Version-Release number of selected component (if applicable):
0.4.19

How reproducible:
every time

Steps to Reproduce:
1. dnf group list
2.
3.

Actual results:

Error: This command has to be run under the root user.

Expected results:

list the groups

Additional info:

dnf group list --noplugins works as a work around

The problem is that the GroupCommand class
is setting 
writes_rpmdb = True

that triggers the noroot plugin.

A solution could be to split the GroupCommand in 2, one with read only commands and one with the commands there is making changes to the system.

Another one is to have an optional nowrite_rpmdb_subcmd = ['install', 'remove', .....]

and change to noroot to look at 

writes_rpmdb = True

and 

subcmd not in nowrite_rpmdb_subcmd
Comment 1 Tim Lauridsen 2014-03-25 03:51:07 EDT
IT should have been :)

nowrite_rpmdb_subcmd = ['list', 'info', .....]
Comment 2 Ales Kozumplik 2014-03-25 07:52:16 EDT
Thanks Tim. This issue awaits the signups implementation and fix to bug 1062889.
Comment 3 Ales Kozumplik 2014-04-07 12:30:28 EDT
Fixed by 680ad20.
Comment 4 Tim Lauridsen 2014-04-08 01:24:22 EDT
group info & group list works as non root now, thanks

All non-root group cmds gives a
[Errno 13] Permission denied: '/var/lib/dnf/groups.json'

this might confuse the user and give a number of bugzilla reports.

group install xxxx is still broken in 0.5

THe issue is in

    def _install(self, extcmds):
        cnt = 0
        types, patterns = self._split_extcmds(extcmds)
        for env in self._patterns2environments(patterns):
            cnt += self.base.environment_install(env, types)
        for grp in self._patterns2groups(patterns):
            cnt += self.base.group_install(grp, types)
        if not cnt:
            msg = _('No packages in any requested groups available to install.')
            raise dnf.cli.CliError(msg)


self._patterns2environments will raise an a CliError("No relevant match for the specified xxxx") if xxxx is not an evironment id.

the patterns2 helper uses by _patterns2groups & _patterns2environments
should proberly not raise and CliError, it should be handled on a higher level.

    def _patterns2(fn, patterns, fltr):
        for pat in patterns:
            grps = fn(pat)
            cnt = 0
            for grp in grps:
                if not fltr(grp):
                    continue
                yield grp
                cnt += 1
            if not cnt:
                msg = _("No relevant match for the specified '%s'.")
                msg = msg % to_unicode(pat)
                raise dnf.cli.CliError(msg)
Comment 5 Tim Lauridsen 2014-04-08 01:25:37 EDT
Created attachment 883863 [details]
fix for group install

Fix for the group install not working isssue
Comment 6 Tim Lauridsen 2014-04-08 01:47:39 EDT
Created attachment 883876 [details]
Better patch
Comment 7 Tim Lauridsen 2014-04-08 01:50:03 EDT
Created attachment 883877 [details]
Better patch (wrong checkout)
Comment 8 Tim Lauridsen 2014-04-08 02:31:17 EDT
Created attachment 883892 [details]
fix for group install

group remove also fixed
demands.resolving set, so the packages are installed/removed
Comment 9 Fedora Update System 2014-05-02 04:32:37 EDT
dnf-0.5.1-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/dnf-0.5.1-1.fc20
Comment 10 Fedora Update System 2014-05-02 17:05:10 EDT
Package dnf-0.5.1-1.fc20, hawkey-0.4.14-1.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing dnf-0.5.1-1.fc20 hawkey-0.4.14-1.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-5937/hawkey-0.4.14-1.fc20,dnf-0.5.1-1.fc20
then log in and leave karma (feedback).
Comment 11 Fedora Update System 2014-05-28 08:10:28 EDT
dnf-plugins-core-0.0.8-2.fc20, libsolv-0.6.1-1.git6d968f1.fc20, hawkey-0.4.16-1.fc20, dnf-0.5.2-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/libsolv-0.6.1-1.git6d968f1.fc20,hawkey-0.4.16-1.fc20,dnf-0.5.2-1.fc20,dnf-plugins-core-0.0.8-2.fc20
Comment 12 Fedora Update System 2014-05-28 19:50:26 EDT
Package dnf-plugins-core-0.0.8-2.fc20, libsolv-0.6.1-1.git6d968f1.fc20, hawkey-0.4.16-1.fc20, dnf-0.5.2-1.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing dnf-plugins-core-0.0.8-2.fc20 libsolv-0.6.1-1.git6d968f1.fc20 hawkey-0.4.16-1.fc20 dnf-0.5.2-1.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-6789/libsolv-0.6.1-1.git6d968f1.fc20,hawkey-0.4.16-1.fc20,dnf-0.5.2-1.fc20,dnf-plugins-core-0.0.8-2.fc20
then log in and leave karma (feedback).
Comment 13 Fedora Update System 2014-05-31 19:59:03 EDT
dnf-plugins-core-0.0.8-2.fc20, libsolv-0.6.1-1.git6d968f1.fc20, hawkey-0.4.16-1.fc20, dnf-0.5.2-1.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

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