-
Notifications
You must be signed in to change notification settings - Fork 24k
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
modules/dnf: Substitute variables in DNF cache path #80094
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
20d0c69
to
ebeb248
Compare
ebeb248
to
905f743
Compare
905f743
to
2fc487b
Compare
This comment was marked as outdated.
This comment was marked as outdated.
b1c7134
to
197e1a6
Compare
This comment was marked as outdated.
This comment was marked as outdated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the changes here we will need a changelog fragment for this PR which is documented here https://docs.ansible.com/ansible/latest/community/development_process.html#creating-changelog-fragments. We would also look at adding some integration tests for this scenario under https://github.com/ansible/ansible/tree/devel/test/integration/targets/dnf. The integration tests might be a bit harder to setup but we can certainly work through them if you have any questions.
The cache directory can be specified with variables that are expanded by DNF, e.g. ``` cachedir=/var/cache/yum/$basearch/$releasever ``` But the `dnf` module would use that path literally, instead of replacing `$basearch` and `$releasever` with their values. This commit ensures that variables in `cachedir` are properly substituted. Signed-off-by: Benoît Knecht <bknecht@protonmail.ch>
Now that the `dnf` module uses `libdnf`, `mypy` returns the following error on `lib/ansible/modules/dnf.py`: ``` import: Cannot find implementation or library stub for module named "libdnf" ``` This commit makes `mypy` ignore missing imports for `libdnf`. Signed-off-by: Benoît Knecht <bknecht@protonmail.ch>
197e1a6
to
607750d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
In ansible#80094 support for var substitution for cachedir was added but there are more options that should be supported. Using an API for prepend_installroot which should be done anyway provide that feature so use that. In addition, perform the operation once all substitutes are in place (releasever as well).
In #80094 support for var substitution for cachedir was added but there are more options that should be supported. Using an API for prepend_installroot which should be done anyway provide that feature so use that. In addition, perform the operation once all substitutes are in place (releasever as well).
SUMMARY
The cache directory can be specified with variables that are expanded by DNF, e.g.
But the
dnf
module would use that path literally, instead of replacing$basearch
and$releasever
with their values.This commit ensures that variables in
cachedir
are properly substituted.ISSUE TYPE
COMPONENT NAME
dnf
ADDITIONAL INFORMATION
To reproduce the issue, set
in
/etc/dnf/dnf.conf
and use thednf
module to install a package. On the target system, Ansible will create a directory called/var/cache/yum/$basearch/$releasever
, instead of/var/cache/yum/x86_64/8
for instance.