voxpupuli / puppet-yum

Puppet module for Yum
https://forge.puppet.com/puppet/yum
MIT License
16 stars 99 forks source link

Use dnf or yum augeas path for main configuration #307

Closed traylenator closed 1 year ago

traylenator commented 1 year ago

Pull Request (PR) description

Currently the augeas path for main configuration is at /files/etc/yum.conf/main.

Use a dnf or yum based path based on the package_provider fact.

On Fedora 36 and newer that hard coded augeas path does not exist:

[steve@fedora ~]$ augtool -e 'print /files/etc/yum.conf/main'
augtool> print /files/etc/yum.conf/main

only the new updated dnf based path exists.

augtool> print /files/etc/dnf/dnf.conf
/files/etc/dnf/dnf.conf
/files/etc/dnf/dnf.conf/#comment = "see `man dnf.conf` for defaults and possible options"
/files/etc/dnf/dnf.conf/main
/files/etc/dnf/dnf.conf/main/gpgcheck = "True"
/files/etc/dnf/dnf.conf/main/installonly_limit = "3"
/files/etc/dnf/dnf.conf/main/clean_requirements_on_remove = "True"
/files/etc/dnf/dnf.conf/main/best = "False"
/files/etc/dnf/dnf.conf/main/skip_if_unavailable = "True"

Note on EL8 and EL9 both paths /files/etc/yum.conf and /files/etc/dnf.conf are valid and equal.

Consequently on puppet runs yum::init sets the installonly_limit to 3 in the wrong non-existing file.

To solve this create a new file yum::settings that can have values set from hiera for the yum::config type. The more obvious use of setting this in init.pp is not possible since including this in yum::config would be a huge change for the module.

Note that when the install_limit is changed to 3 the following command is called

/usr/bin/package-cleanup --oldkernels --count=3 -y

and this is bug #295 . This patch hides that problem in acceptance tests again.

traylenator commented 1 year ago

merging red on Fedora but it must be red on fedora in master branch also. its less red that it was. Two more things to fix but they deserve their own MR.