Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dnf module does not remove rpms from cache after installation #81954

Closed
1 task done
opoplawski opened this issue Oct 11, 2023 · 8 comments · Fixed by #82735
Closed
1 task done

dnf module does not remove rpms from cache after installation #81954

opoplawski opened this issue Oct 11, 2023 · 8 comments · Fixed by #82735
Labels
affects_2.16 bug This issue/PR relates to a bug. has_pr This issue has an associated PR. module This issue/PR relates to a module.

Comments

@opoplawski
Copy link
Contributor

Summary

When the dnf module installs a new package or update, the rpm is left in /var/cache/dnf. This is unexpected since keepcache=false is the default for dnf which tells it to remove the rpm from the cache after installation.

Issue Type

Bug Report

Component Name

dnf

Ansible Version

$ ansible --version
ansible [core 2.16.0b2.post0] (stable-2.16 9c91e578d0) last updated 2023/10/11 11:49:36 (GMT -600)
  config file = /export/home/USER/ansible/ansible.cfg
  configured module search path = ['/export/home/USER/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /export/home/USER/ansible/lib/ansible
  ansible collection location = /export/home/USER/.ansible/collections:/usr/share/ansible/collections
  executable location = ./bin/ansible
  python version = 3.11.2 (main, Oct  5 2023, 18:41:49) [GCC 8.5.0 20210514 (Red Hat 8.5.0-18)] (/usr/bin/python3.11)
  jinja version = 3.1.2
  libyaml = True

Configuration

# if using a version older than ansible-core 2.12 you should omit the '-t all'
$ ansible-config dump --only-changed -t all
CONFIG_FILE() = /export/home/USER/ansible/ansible.cfg
DEFAULT_HOST_LIST(/export/home/USER/ansible/ansible.cfg) = ['/export/home/USER/ansi>
EDITOR(env: EDITOR) = vim
PAGER(env: PAGER) = less

SHELL:
=====

sh:
__
remote_tmp(/export/home/USER/ansible/ansible.cfg) = /tmp

OS / Environment

AlmaLinux 8.8

Steps to Reproduce

find /var/cache/dnf -name \*.rpm -delete
./bin/ansible -m dnf -a 'name=fpack state=present use_backend=dnf4' --user root HOSTNAME -vvv -e ansible_python_interpreter=/usr/bin/python3.11
find /var/cache/dnf -name \*.rpm

Expected Results

No rpm files in /var/cache.

Actual Results

/var/cache/dnf/epel-4e020062450c4732/packages/fpack-3.47-1.el8.x86_64.rpm

 SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o 'ControlPath="/export/home/USER/.ansible/cp/317e511b29"' HOSTNAME '/bin/sh -c '"'"'rm -f -r /tmp/ansible-tmp-1697046623.8425725-490969-163230780326490/ > /dev/null 2>&1 && sleep 0'"'"''
<HOSTNAMEm> (0, b'', b'')
HOSTNAME | CHANGED => {
    "changed": true,
    "invocation": {
        "module_args": {
            "allow_downgrade": false,
            "allowerasing": false,
            "autoremove": false,
            "bugfix": false,
            "cacheonly": false,
            "conf_file": null,
            "disable_excludes": null,
            "disable_gpg_check": false,
            "disable_plugin": [],
            "disablerepo": [],
            "download_dir": null,
            "download_only": false,
            "enable_plugin": [],
            "enablerepo": [],
            "exclude": [],
            "install_repoquery": true,
            "install_weak_deps": true,
            "installroot": "/",
            "list": null,
            "lock_timeout": 30,
            "name": [
                "fpack"
            ],
            "nobest": false,
            "releasever": null,
            "security": false,
            "skip_broken": false,
            "sslverify": true,
            "state": "present",
            "update_cache": false,
            "update_only": false,
            "use_backend": "auto",
            "validate_certs": true
        }
    },
    "msg": "",
    "rc": 0,
    "results": [
        "Installed: fpack-3.47-1.el8.x86_64"
    ]
}

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibot ansibot added bug This issue/PR relates to a bug. needs_triage Needs a first human triage before being processed. affects_2.16 module This issue/PR relates to a module. labels Oct 11, 2023
@ansibot
Copy link
Contributor

ansibot commented Oct 11, 2023

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the component bot command.

@opoplawski
Copy link
Contributor Author

This also seems to happen with apt, at least with 2.14.11. But I imagine that should have its own report...

@mkrizek
Copy link
Contributor

mkrizek commented Oct 12, 2023

We might want to look at utilizing the dnf.Base.close() method: https://github.com/rpm-software-management/dnf/blob/2c1a38875e94353b0ff58b423340aca6441521ab/dnf/base.py#L531

@k4izyy
Copy link

k4izyy commented Oct 16, 2023

Hi, can I be assigned to this issue?

@bcoca bcoca removed the needs_triage Needs a first human triage before being processed. label Oct 17, 2023
@bcoca
Copy link
Member

bcoca commented Oct 17, 2023

@KayZ4711 no need to assign, just open a PR and reference this issue in subjet with fixes #<issue number>

@Akasurde
Copy link
Member

@k4izyy Are you working on this?

@k4izyy
Copy link

k4izyy commented Nov 28, 2023 via email

@voidquark
Copy link

Is there anyone working on this issue?

mkrizek added a commit to mkrizek/ansible that referenced this issue Feb 22, 2024
@ansibot ansibot added the has_pr This issue has an associated PR. label Feb 22, 2024
mkrizek added a commit that referenced this issue Feb 27, 2024
@ansible ansible locked and limited conversation to collaborators Mar 12, 2024
bcoca pushed a commit to bcoca/ansible that referenced this issue Mar 19, 2024
sivel pushed a commit to sivel/ansible that referenced this issue Apr 2, 2024
Fixes ansible#81954
(cherry picked from commit 77ab7af)

Co-authored-by: Martin Krizek <martin.krizek@gmail.com>
sivel added a commit that referenced this issue Apr 10, 2024
Fixes #81954
(cherry picked from commit 77ab7af)

Co-authored-by: Martin Krizek <martin.krizek@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.16 bug This issue/PR relates to a bug. has_pr This issue has an associated PR. module This issue/PR relates to a module.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants