Closed bschonec closed 1 year ago
I don't think it's an issue with the module. There is no relationship defined between nmon package and yum class by default. In general, package can be non-yum or coming from other repositories, not defined by yum class. You have to be explicit to provide relationship, if it's required.
either require yum
class in your manifest instead of just include
or specify this relationship in the package
package { 'nmon':
ensure => installed,
require => Class['yum'],
}
I understand your point but in order for the repository to be usable the GPG key needs to be installed/imported before any attempt to install packages from that repo can be successful.
If I had fifteen packages from EPEL that need to be installed, then conceivably, I'd have to order all of them before the yum class module. If the requirement for the GPG key was backed into the yum class module, those ordering constraints would disappear.
Would a 'contain' be appropriate for that?
yum::gpgkey is a defined resource and they are contained in yum class and will be defined together with yum repositories
require yum
should solve your problem
You also can contain yum class within a profile and establish relationship this way
class profile::server {
require profile::yum
class profile::yum {
contain yum
Thank you for the useful information. I'll give that a try.
Affected Puppet, Ruby, OS and module versions/distributions
How to reproduce (e.g Puppet code you use)
The GPG key for the EPEL repository is not installed:
Using a simple site.pp file:
common.yaml:
What are you seeing
The module is creating the /etc/yum.repos.d/epel.repo file properly but then the Package resource is trying to install the 'nmon' package before the EPEL GPG key is imported into the RPM database. This causes yum/dnf to complain because the /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 file doesn't yet exist and hence the EPEL GPG key is not imported.
After the attempt to install the nmon package, the yum::gpgkey defined type THEN executes, properly installing the /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 and importing the RPM GPG key.
What behaviour did you expect instead
The EPEL GPG key file should already exist and be "rpm --import"ed into the RPM database before package resources are installed.
Output log
Any additional information you'd like to impart
My assumption is that the repo file, the rpm-gpg file and the GPG key should exist and be imported before any attempt to install packages from the repository.