Bug 1213848

Summary: [RFE] implement automatically yes mode in run()
Product: [Fedora] Fedora Reporter: Igor Gnatenko <ignatenko>
Component: dnf-plugins-extrasAssignee: rpm-software-management
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: e, extras-qa, ignatenko, jkadlcik, jmracek, jrohel, jzeleny, mluscon, msuchy, packaging-team-maint, rjones, rpm-software-management, vmukhame, xjakub
Target Milestone: ---Keywords: EasyFix, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1211344 Environment:
Last Closed: 2017-08-31 10:34:11 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1211344    

Description Igor Gnatenko 2015-04-21 12:32:07 UTC
+++ This bug was initially created as a clone of Bug #1211344 +++

Description of problem:

If you accidentally install the rpmconf plugin, then you
see apt-like interactive file updates:

$ sudo dnf -y install kernel
Failed to synchronize cache for repo '_local' from 'file:///var/lib/dnf/plugins/local': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried, disabling.
Using metadata from Mon Apr 13 16:57:02 2015 (0:48:44 hours old)
Package kernel-4.0.0-0.rc5.git2.1.fc23.x86_64 is already installed, skipping.
Package kernel-4.0.0-0.rc5.git4.1.fc23.x86_64 is already installed, skipping.
Package kernel-4.0.0-0.rc6.git2.1.fc23.x86_64 is already installed, skipping.
Dependencies resolved.
Nothing to do.
local: '/var/lib/dnf/plugins/local' is not a directory
Configuration file '/etc/pam.d/fingerprint-auth'
lrwxrwxrwx. 1 root root  19 Feb 21  2012 /etc/pam.d/fingerprint-auth -> fingerprint-auth-ac
-rw-r--r--. 1 root root 701 May  9  2012 /etc/pam.d/fingerprint-auth.rpmnew

 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      M     : merge configuration files
      Z     : background this process to examine the situation
      S     : skip this file
 The default action is to keep your current version.Your choice: 

Unfortunately these do not obey 'dnf -y'.

Also ^C doesn't quit dnf in this dialog.

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

dnf-plugins-extras-0.0.6-2.fc23.noarch
python3-dnf-plugins-extras-rpmconf-0.0.6-2.fc23.noarch

How reproducible:

100%

Steps to Reproduce:
1. Accidentally install dnf-plugins-extras
2. Use dnf -y install command

--- Additional comment from Radek Holy on 2015-04-14 05:26:35 EDT ---

Actually, from the definition of the '-y' switch, this plugin should always select "Y" if "-y" is used.
I just wanted to let you know since I believe that it might not be what you have probably expected.

--- Additional comment from Miroslav Suchý on 2015-04-16 04:18:55 EDT ---

I would proposet the when "dnf -y" is set that this plugin either does nothing or just print name of configs which needs merging (which would need RFE in rpmconf itself).

--- Additional comment from Radek Holy on 2015-04-16 04:46:57 EDT ---

Yes, that would make sense to me but it is not aligned with the description of the "-y" switch: "answer yes for all questions".
So, we would have either change the description to something like "plugins may implement this switch in a different way" or the rpmconf would have to document that it works differently if "-y" is used.

--- Additional comment from Richard W.M. Jones on 2015-04-16 04:52:27 EDT ---

(In reply to Radek Holy from comment #3)
> Yes, that would make sense to me but it is not aligned with the description
> of the "-y" switch: "answer yes for all questions".
> So, we would have either change the description to something like "plugins
> may implement this switch in a different way" or the rpmconf would have to
> document that it works differently if "-y" is used.

Leaving aside what the -y flag currently is documented as doing,
what we as users _need_ is a flag that means "do not ever be
interactive under any circumstances".

For example at the moment, virt-builder hangs if you do:

  virt-builder fedora-22 --install dnf,dnf-plugins-extras --update

because the --update flag runs 'dnf -y update'.

--- Additional comment from Radek Holy on 2015-04-16 05:08:28 EDT ---

Yes, I see. The documentation probably should explicitly say that the purpose is to switch DNF into an non-interactive mode. And the only thing that can be done wrt to the plugins is to remind plugin developers to respect DNF's global switches.

Comment 1 Miroslav Suchý 2017-04-05 11:54:26 UTC
rpmconf does not have any safe option which can be executed when -y is passed.
What I recommend is to call rpmconf.rpmconf(..., test=True) when -y is passed to DNF. This will print files which need to be merged and returns non zero result. Or it return 0 if there are no files to merge

Rpmconf plugin should IMO jest test the existence of those file when -y is used and do not try to actually merge anything.

Note: test=True just landed in master and will be available in rawhide in day or two.

Comment 2 Jaroslav Rohel 2017-04-28 10:56:49 UTC
>Description of problem:
>
>If you accidentally install the rpmconf plugin, then you
>see apt-like interactive file updates:

I done some tests today:
I could't reproduce the problem. So I looked to the code of rpmconf plugin.

Probably this problem was fixed 10 months ago: https://github.com/rpm-software-management/dnf-plugins-extras/commit/f9f3b94bb012624520fb25e91cb1930c579f7ef3
This patch sets non-interactive mode for -y. It seems that plugin only reads its configuration in this mode, nothing more. 

So from my point of view it is about documentation now. We must explain meaning of  -y option to user (it is about switching to non-interactive mode and answer yes to simple yes/no questions?). Because "-y" switch: "answer yes for all questions" is not true now.

Or we can add new option for activating non-interactive mode.  And -y can be used as proposed in documentation. Always assume yes. 
Eg. help for aptitude (pkg manager application in Debian) says: "-y Assume that the answer to simple yes/no questions is 'yes'." So only for simple questions. 

So again main problem of rpmconf plugin was fixed 10 months ago. What we can do now?
- change documentation of -y option
- improve rpmconf pugin non-interactive mode - to print which file need to be merged (silently ignored now) as supposed by Miroslav Suchý
- introduce a new option for non-interactive mode (probably no, another incompatibility)

Comment 3 Richard W.M. Jones 2017-04-28 11:09:48 UTC
We really need a "just do it" option, so we can run dnf under
virt-customize.  There is *no interactivity possible* in this
scenario, so anything which interacts with the user is broken.

Comment 4 Jaroslav Mracek 2017-08-04 11:42:13 UTC
*** Bug 1211344 has been marked as a duplicate of this bug. ***

Comment 5 Jaroslav Mracek 2017-08-31 10:34:11 UTC
It looks like that the issue was fixed in dnf-plugin-rpmconf-2.0.0-1 available for Fedora 26+. Please if you will find that current implementation is incorrect, please don't hesitate to reopen the bug report.