I have this: node /prod\-(blitz|cisco|masdar|dow)\-app\-01.c3\-e.com/ inherits basenode-rhel { $splunk_loghost = "loghost.c3platform.com" include splunkforwarder::c3_app_server } class splunkforwarder::c3_app_server inherits splunkforwarder::common { notice("loghost=$splunk_loghost") } In the c3_app_server class, when notice() is called, the splunk_loghost variable is not set. How come? This is puppet version 2.6.2. Doug. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Grrrrr. On Thu, Dec 15, 2011 at 9:11 AM, Douglas Garstang <doug.garstang@gmail.com> wrote:> I have this: > > node /prod\-(blitz|cisco|masdar|dow)\-app\-01.c3\-e.com/ inherits > basenode-rhel { > $splunk_loghost = "loghost.c3platform.com" > include splunkforwarder::c3_app_server > } > > class splunkforwarder::c3_app_server inherits splunkforwarder::common { > notice("loghost=$splunk_loghost") > } > > > In the c3_app_server class, when notice() is called, the > splunk_loghost variable is not set. How come? This is puppet version > 2.6.2. > > Doug.-- Regards, Douglas Garstang http://www.linkedin.com/in/garstang Email: doug.garstang@gmail.com Cell: +1-805-340-5627 -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Dec 15, 11:11 am, Douglas Garstang <doug.garst...@gmail.com> wrote:> I have this: > > node /prod\-(blitz|cisco|masdar|dow)\-app\-01.c3\-e.com/ inherits > basenode-rhel { > $splunk_loghost = "loghost.c3platform.com" > include splunkforwarder::c3_app_server > > } > > class splunkforwarder::c3_app_server inherits splunkforwarder::common { > notice("loghost=$splunk_loghost") > > } > > In the c3_app_server class, when notice() is called, the > splunk_loghost variable is not set. How come? This is puppet version > 2.6.2.Two possibilities come to mind: 1) node basenode-rhel directly or indirectly includes class splunkforwarder::c3_app_server, so $splunk_loghost is evaluated in that node''s dynamic scope, instead of in the scope you expect. 2) class splunkforwarder::common sets an empty value for a variable $splunk_loghost in its namespace, and the subclass resolves $splunk_loghost to its superclass''s variable instead of to the node variable. This is the sort of problem that parameterized classes were designed to solve, and that external data solves better. I recommend choosing one of those approaches so that the source of your $splunk_loghost data is clear and well-defined. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.