RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1862970 - python3-dnf does not respect cacheonly
Summary: python3-dnf does not respect cacheonly
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: dnf
Version: 8.2
Hardware: Unspecified
OS: Unspecified
high
unspecified
Target Milestone: rc
: 8.0
Assignee: Jaroslav Rohel
QA Contact: Tomáš Bajer
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-08-03 11:02 UTC by Michael Mráka
Modified: 2022-05-10 16:40 UTC (History)
8 users (show)

Fixed In Version: dnf-4.7.0-5.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2026849 (view as bug list)
Environment:
Last Closed: 2022-05-10 15:23:43 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2022:2051 0 None None None 2022-05-10 15:23:48 UTC

Description Michael Mráka 2020-08-03 11:02:42 UTC
Description of problem:
python3-dnf downloads metadata even if cacheonly is set.

Version-Release number of selected component (if applicable):
dnf-4.2.17-7.el8_2.noarch
(and dnf-4.2.23-1.git.9175.126d861.el8.noarch)

How reproducible:
always

Steps to Reproduce:
1. cat >cacheonly.py <<EOF
import dnf
import os
import sys

cacheonly = True if len(sys.argv) > 1 else False
CENTOS='http://mirror.centos.org/centos-8/8/BaseOS/x86_64/os/'

with dnf.base.Base() as base:
    base.conf.module_platform_id = 'platform:el8'
    base.conf.installroot = os.path.abspath('./instalroot')
    base.conf.cachedir = os.path.abspath('./instalroot/var/cache/dnf')
    base.conf.cacheonly = cacheonly
    repo = base.repos.add_new_repo('baseos', base.conf, baseurl=[CENTOS], skip_if_unavailable=True)
    base.fill_sack(load_system_repo=False)
    print("Cacheonly:", base.conf.cacheonly)
    print("Loaded repos:", len(base.repos))
    print("Loaded packages:", len(base.sack.query()))
EOF
2. python3 ./cacheonly.py
3. ls -l instalroot/var/cache/dnf/
4. rm -rf instalroot/var/cache/dnf/*
4. python3 ./cacheonly.py cacheonly
5. ls -ll instalroot/var/cache/dnf/

Actual results:

Cacheonly: False
Loaded repos: 1
Loaded packages: 1675
drwxr-xr-x. 3 michael michael      22 Aug  3 12:56 baseos-7ce9369cf52b8f9b
-rw-rw-r--. 1 michael michael 1299280 Aug  3 12:56 baseos-filenames.solvx
-rw-rw-r--. 1 michael michael 1372757 Aug  3 12:56 baseos.solv

Cacheonly: True
Loaded repos: 1
Loaded packages: 1675
drwxr-xr-x. 3 michael michael      22 Aug  3 12:59 baseos-7ce9369cf52b8f9b
-rw-rw-r--. 1 michael michael 1299280 Aug  3 12:59 baseos-filenames.solvx
-rw-rw-r--. 1 michael michael 1372757 Aug  3 12:59 baseos.solv


Expected results:
Dnf doesn't download metadata in the second case and thus fails to load it.

Additional info:

Comment 7 Jaroslav Rohel 2021-11-05 09:39:54 UTC
PR https://github.com/rpm-software-management/dnf/pull/1792

Comment 16 errata-xmlrpc 2022-05-10 15:23:43 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (dnf bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:2051


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