Bug 1062884 - [api] Allow dnf plugin to set exit code
Summary: [api] Allow dnf plugin to set exit code
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf   
(Show other bugs)
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Ales Kozumplik
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-02-08 10:51 UTC by Miroslav Suchý
Modified: 2014-09-30 23:42 UTC (History)
4 users (show)

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 23:58:20 UTC
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)

Description Miroslav Suchý 2014-02-08 10:51:37 UTC
Description of problem:
DNF plugin should be able to set non-zero exit code but allow dnf to continue.
For history and reasoning see yum bug 982122 (and original reason of user in bug 982068).

Comment 1 Ales Kozumplik 2014-02-10 08:10:02 UTC
similar to bug 1062889, needs the signup mechanism.

Comment 2 Ales Kozumplik 2014-03-31 11:43:30 UTC
Related: bug 658210, bug 684859. Very chaotic.

What we will provide in DNF is a code for exits that core DNF itself considers a success otherwise. If DNF CLI for instance encounters unreadable main config file or similar it will terminate with its own error soon (i.e. 1).

Note it's probably not an entirely solid design for a plugin to use the return value to communicate some sort of semi-error to the user. Plugins can raise an exception if they fail which will be propagated to DNF, logged to the terminal and handled as a DNF error (i.e. return code 1 again).

Comment 3 Miroslav Suchý 2014-03-31 12:15:01 UTC
Why should be all errors fatals? And raising of exception will mean termination of DNF. I can see those level:

1) warning to stderr
2) warning to stderr with non zero return code
3) fatal error with non zero return code

1 and 3 is currently possible. 2 is not possible.
I see use case of 2) when some non fatal error occurred, and human can usually handle it. But automated script should rather process it as error. And status code is much better than parsing stderr of DNF.

Comment 4 Ales Kozumplik 2014-03-31 14:24:17 UTC
Right, that's what the fix will allow.

Comment 5 Ales Kozumplik 2014-04-01 13:33:16 UTC
Fixed on master by 8830a1c.

The plugins can now do e.g.

  cli.demands.success_exit_status = 29

To set the program exit status for cases where it does not terminate with a fatal error.

Comment 6 Fedora Update System 2014-05-02 08:32:00 UTC
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 7 Fedora Update System 2014-05-02 21:04:31 UTC
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 8 Fedora Update System 2014-05-28 12:09:50 UTC
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 9 Fedora Update System 2014-05-28 23:49:48 UTC
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 10 Fedora Update System 2014-05-31 23:58:20 UTC
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.