I am using puppet 2.7.14 I have a class that I use just to define a bunch of variables used by my module, several of them used in more than once place. Currently I have it in module/manifests/classes/module_vars.pp In some of the other classes, I was able to use the variables by qualifying the name - module::module_vars::var However, I am having trouble getting these variables to show up in my templates. First I just tried using the plain name, then I tried using scope.lookupvar(module_vars::var) scope.lookupvar(module::module_vars::var) but all that shows up in my template is "undefined". I''ve looked through the documentation, but I can''t figure out what I am doing wrong. Thank you. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/HEur3xu9Fb4J. 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 6/7/12 10:14 AM, llowder@oreillyauto.com wrote:> I am using puppet 2.7.14 > > I have a class that I use just to define a bunch of variables used by my > module, several of them used in more than once place. > > Currently I have it in module/manifests/classes/module_vars.pp > > In some of the other classes, I was able to use the variables by > qualifying the name - module::module_vars::var > > However, I am having trouble getting these variables to show up in my > templates. > > First I just tried using the plain name, then I tried using > | > ||scope.lookupvar(module_vars::var)| > |scope.lookupvar(module::module_vars::var) > > but all that shows up in my template is "undefined". > > I''ve looked through the documentation, but I can''t figure out what I am > doing wrong. > > Thank you.One method would be to bring them into the local scope. class foo { $var = $variables::var } then in your template you could use <%= var %> Two issues I spotted though. Your path setup is not correct for the auto-loader. Suggested reading - http://docs.puppetlabs.com/puppet/2.7/reference/modules_fundamentals.html Also, check out Hiera - http://puppetlabs.com/blog/first-look-installing-and-using-hiera/ -g -- Garrett Honeycutt 206.414.8658 http://puppetlabs.com -- 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.
Possibly the templates in question are being evaluated before the module_vars.pp Check the master log for something like: "Could not look up qualified variable ''module::module_vars::var''; class module has not been evaluated" G -- 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.