Bug 1565041

Summary: dnf returns 0 on install when repository is unavailable
Product: [Fedora] Fedora Reporter: Olli Jarva <ojarva>
Component: dnfAssignee: rpm-software-management
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 27CC: dmach, mhatina, ojarva, packaging-team-maint, rpm-software-management, vmukhame
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-09 12:52:44 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:

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.

Comment 3 Red Hat Bugzilla 2023-09-14 04:26:32 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 1000 days