Reputation: 10460
I include the class nova::compute::libvirt
and this class defines a Package resource like so:
package { 'libvirt-nwfilter':
ensure => present,
name => $::nova::params::libvirt_nwfilter_package_name,
before => Service['libvirt'],
tag => ['openstack', 'nova-support-package'],
}
The problem is that the RPM is in a YUM repo that is not enabled enabled=0
.
I could solve this issue by changing nova::conpute::libvirt
so that Package resource looked like this:
package { 'libvirt-nwfilter':
ensure => present,
name => $::nova::params::libvirt_nwfilter_package_name,
before => Service['libvirt'],
tag => ['openstack', 'nova-support-package'],
install_options => ['--enablerepo', 'redhat_updates'],
}
But I'd like to not have to modified a module I got from puppet forge because the next time someone else setups up a puppet master they might forget to make the modification. Is there something I can do from the class that includes nova::compute::libvirt
?
Upvotes: 1
Views: 176
Reputation: 180093
Resource collectors afford the possibility of overriding attributes of resources declared elsewhere. The syntax would be:
Package<| title == 'libvirt-nwfilter' |> {
install_options => ['--enablerepo', 'redhat_updates']
}
That alternative avoids modifying the repository definition, and it does not require introducing any new ordering relationships. Beware, however, that collectors always realize any matching virtual resources. Beware also that this approach is very powerful, and thus very easy to abuse to get yourself in trouble. With great power comes great responsibility.
Upvotes: 1
Reputation: 28739
You can solve this problem by enabling the redhat_updates
yum repo with a yumrepo
resource, and then specifying a metaparameter for it to be applied before the class.
yumrepo { "redhat_updates":
baseurl => "baseurl",
descr => "Redhat Updates",
enabled => 1,
gpgcheck => 0,
before => Class['nova::compute::libvirt'],
}
https://docs.puppet.com/puppet/latest/types/yumrepo.html
Upvotes: 1