-
Notifications
You must be signed in to change notification settings - Fork 23.7k
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 ignores repo files inside installroot
path
#80644
Comments
Files identified in the description: If these files are incorrect, please update the |
note: installroot might not be a current feature of the module, this is probably a RFE |
@bcoca |
Use case example: https://github.com/mskarbek/containers/blob/main/micro/tasks/rhel.yaml |
This is what I did in an attempt to reproduce the issue:
inside the container:
Running the following playbook: - hosts: container
gather_facts: false
tasks:
- dnf:
name:
- "glibc-minimal-langpack"
- "coreutils-single"
disablerepo: "*"
enablerepo: "baseos"
disable_plugin:
- "subscription-manager"
install_weak_deps: false
releasever: 9
state: "latest"
disable_gpg_check: true
installroot: /tmp/installroot produces the following output:
So I was not able to replicate the issue. To move this issue forward we would need a minimal self-contained reproducer to replicate the issue in order to debug it. needs_info |
@mkrizek you will replicate this issue only when the repo file is in |
Then a simple reproducer would be: # podman run --name container --rm -it --entrypoint bash almalinux:9
- hosts: container
gather_facts: false
vars:
installroot_path: /tmp/installroot
tasks:
- shell: "mkdir -p {{ installroot_path}}/etc/yum.repos.d/ && mv /etc/yum.repos.d/almalinux-baseos.repo {{ installroot_path }}/etc/yum.repos.d/"
- dnf:
name: coreutils-single
releasever: 9
installroot: "{{ installroot_path }}" This would require more testing but this appears to be a fix: diff --git a/lib/ansible/modules/dnf.py b/lib/ansible/modules/dnf.py
index 3bfca3cd715..02e114ba2f7 100644
--- a/lib/ansible/modules/dnf.py
+++ b/lib/ansible/modules/dnf.py
@@ -652,6 +652,8 @@ class DnfModule(YumDnf):
# Load substitutions from the filesystem
conf.substitutions.update_from_etc(installroot)
+ conf._search_inside_installroot('reposdir')
+
# Handle different DNF versions immutable mutable datatypes and
# dnf v1/v2/v3
# Note that the |
Summary
When using
installroot
option,dnf
module ignores repo files insideinstallroot
path.The playbook creates an empty directory (actually it is
buildah
mount point, but that should be irrelevant to this issue) and then creates a minimaldnf
configuration addingdnf.conf
and repo file inside that empty directory.dnf
command will work just fine:dnf
module fails because it tries to use repo files in host/etc/yum.repos.d
not in the container path. When I copy the repo file to the host path,dnf
module works fine.Issue Type
Bug Report
Component Name
dnf
Ansible Version
Configuration
OS / Environment
RHEL 9.1
Steps to Reproduce
Expected Results
dnf
module properly installs packages ininstallroot
path using repo files insideinstallroot
.Actual Results
The text was updated successfully, but these errors were encountered: