Hi all,
I'm using puppet for quite some time - about 10 years - but now I have a
problem that I can not fix.
I hope someone here can help me. I tried to google the problem, but the
solutions I found did not work.
The things that I tried are still in as a comment.
I have created a puppet modul that should be updated to include a config
class (normaly called a params class).
I simplified my setup and attached it at the end.
In the class servicea I tried to access the variable from the config
class, but I'm apparently not able to.
Can someone help me?
I case it is important I'm running Orcharhino 6.1. The Puppet-agent is
puppet-agent-6.28.0-1.el8.x86_64.
The output of puppet agent -t is:
Notice: In Config the servertype is: Frontend-Server
Notice: /Stage[main]/Testa/Testa::Config[config]/Notify[In Config the
servertype is: Frontend-Server]/message: defined 'message' as 'In Config
the servertype is: Frontend-Server'
Notice: In Config the cluster_name is: mycluster
Notice: /Stage[main]/Testa/Testa::Config[config]/Notify[In Config the
cluster_name is: mycluster]/message: defined 'message' as 'In Config the
cluster_name is: mycluster'
Notice: In servicea the servertype is : Frontend-Server
Notice: /Stage[main]/Testa::Servicea/Notify[In servicea the servertype
is : Frontend-Server]/message: defined 'message' as 'In servicea the
servertype is : Frontend-Server'
Notice: in servicea the servicea_servicea are 1:
Notice: /Stage[main]/Testa::Servicea/Notify[in servicea the
servicea_servicea are 1: ]/message: defined 'message' as 'in servicea
the servicea_servicea are 1: '
Notice: in servicea the servicea_servicea are 2:
Notice: /Stage[main]/Testa::Servicea/Notify[in servicea the
servicea_servicea are 2: ]/message: defined 'message' as 'in servicea
the servicea_servicea are 2: '
Notice: in servicea the servicea_servicea are 3:
Notice: /Stage[main]/Testa::Servicea/Notify[in servicea the
servicea_servicea are 3: ]/message: defined 'message' as 'in servicea
the servicea_servicea are 3: '
Notice: in servicea the servicea_servicea are 4:
Notice: /Stage[main]/Testa::Servicea/Notify[in servicea the
servicea_servicea are 4: ]/message: defined 'message' as 'in servicea
the servicea_servicea are 4: '
Notice: Applied catalog in 10.88 seconds
So you see that the variable is available from the config class, but
only the variable from init.pp is still accessible from the serivea
class. From the config class the variable is not avilable.
Thanks for any hints in advanced
Greetings from Frankfurt / Germany.
CU
Jens Kühnel
This are the classes
# File init.pp
class testa (
$config = '',
$servertype = '',
) {
create_resources(testa::config, $config)
}
# File config.pp
define testa::config (
$cluster_name = '',
) {
# include testa
$servertype = $testa::servertype
notify{"In Config the servertype is: ${servertype}": }
notify{"In Config the cluster_name is: ${cluster_name}": }
include testa::servicea
}
# File servicea.pp
class testa::servicea {
#include testa::config
#Class[testa::config] -> Class[testa::servicea]
$servicea_cluster_name = $testa::config::servicea_cluster_name
notify{"In servicea the servertype is : ${testa::servertype}": }
notify{"in servicea the servicea_servicea are 1:
${::testa::config::servicea_servicea}": }
notify{"in servicea the servicea_servicea are 2:
${testa::config::servicea_servicea}": }
notify{"in servicea the servicea_servicea are 3:
${testa::servicea_servicea}": }
notify{"in servicea the servicea_servicea are 4: ${servicea_servicea}": }
}
--
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 puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/e6777d5b-413e-01cb-efbb-29018fa2483e%40kuehnel.org.