Bug 1062884 - [api] Allow dnf plugin to set exit code
[api] Allow dnf plugin to set exit code
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: dnf (Show other bugs)
rawhide
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Ales Kozumplik
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2014-02-08 05:51 EST by Miroslav Suchý
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:58:20 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)

  None (edit)
Description Miroslav Suchý 2014-02-08 05:51:37 EST
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 03:10:02 EST
similar to bug 1062889, needs the signup mechanism.
Comment 2 Ales Kozumplik 2014-03-31 07:43:30 EDT
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 08:15:01 EDT
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 10:24:17 EDT
Right, that's what the fix will allow.
Comment 5 Ales Kozumplik 2014-04-01 09:33:16 EDT
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 04:32:00 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 7 Fedora Update System 2014-05-02 17:04:31 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 8 Fedora Update System 2014-05-28 08:09:50 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 9 Fedora Update System 2014-05-28 19:49:48 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 10 Fedora Update System 2014-05-31 19:58:20 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.