I have a class something like this, where I'm passing a [hiera] hash (
zpack_hash) to it:
class installer::zenpack($zpack_hash) {
>
> define zpack_installer($sure='present', $inst='false') {
>
> $z_pack = $installer::zenpack::zpack_hash[$name]
> $zp_ver = inline_template("<%= @z_pack['ver'].to_s.chomp %>")
> $zp_repo = inline_template("<%= @z_pack['rep'].to_s.chomp %>")
> $zp_rqed = inline_template("<%= @z_pack['req'].to_s.chomp %>")
>
> package { $name:
> ensure => $sure ? { present => $zp_ver, default => $sure },
> notify => Exec[ 'refresh_zenpack_daemons',
> 'create_default_conf' ],
> require => [
> File[ '/opt/zenpack/etc/global.conf' ],
> Yumrepo[ $zp_repo ],
> ];
> }
> }
> $my_zpack_list = keys($zpack_hash)
> zpack_installer { $my_zpack_list: }
> }
>
Later in my module, how can I use any of the variables (e.g. $zp_repo) that
are already defined in the zpack_installer? I tried something like this:
class packages::zenpacks::core {
> $hr_zenoss_zpack_core = hiera_hash('zenoss_four::zpack_core',
> undef)
>
> class { 'installer::zenpack':
> zpack_hash => $hr_zenoss_zpack_core,
> require => [
> Yumrepo[
> $installer::zenpack::zpack_installer::zp_repo
> ],
> File[ '/opt/zenoss/etc/global.conf' ],
> Installer::Zenpack::Zpack_installer[ $installer::
> zenpack::zpack_installer::zp_rqed ],
> ];
> }
> }
>
but that's not working; throwing in errors like:
err: Failed to apply catalog: Could not find dependency Yumrepo[undef] for
> Class[Installer::Zenpack]
>
on the lines that marked in red. It works just fine if I comment out these
two lines. any help/suggestion from any one?
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/f11a912b-4157-4cab-bcad-ddb004c33a21%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.