Bug 1565041 - dnf returns 0 on install when repository is unavailable [NEEDINFO]
Summary: dnf returns 0 on install when repository is unavailable
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: 27
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: rpm-software-management
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-04-09 08:46 UTC by Olli Jarva
Modified: 2018-04-09 12:52 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-04-09 12:52:44 UTC
Type: Bug
mhatina: needinfo? (ojarva)


Attachments (Terms of Use)

Description Olli Jarva 2018-04-09 08:46:33 UTC
Description of problem:

There is no option to make dnf fail early if repo is broken. If there are multiple repositories (for example, Fedora base and a local repository providing newer versions for some packages), and local repo is unavailable

1) fetching local repo information will fail with message to stderr,
2) version from Fedora repository will be installed,
3) dnf exits with 0


dnf version:

Version      : 2.7.5
Release      : 2.fc27

How reproducible:

Always with simple setup steps.

Steps to Reproduce:
1. Add a new repository
2. Change repository URL to non-existing (domain or path)
3. Run "dnf install <whatever package>

Actual results:

dnf outputs to stderr: 

> Failed to synchronize cache for repo '<repo name>', disabling.

and continues the process, installing package if if is available in any repository that was working.

Expected results:

dnf exiting with !=0, possibly when additional option is specified (--abort-on-warning or something similar).


Additional info:

Comment 1 Martin Hatina 2018-04-09 11:13:31 UTC
Hi, does your repo file contain 'skip-if-unavailable=False'? If not, dnf ends with 0, which is correct.

Comment 2 Olli Jarva 2018-04-09 12:52:44 UTC
Ah-ha. Yes, setting 'skip-if-unavailable=False' fixes the issue. Sorry, I assumed finding this from dnf man page (or with googling), and I didn't check configuration reference thoroughly.


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