Chaos Golubitsky
2008-Apr-10 17:07 UTC
[Puppet Users] variable containing name of current module?
Does puppet export a variable containing the name of the module currently being processed? That is, if i''m reading the file "modules/ntp/manifests/whatever.pp", is there any puppet variable containing the string "ntp"? That''s the entire question --- here''s the context in case it helps: I have a wrapper function which implements a search path for files: config_file(i $owner = root, ... $module = generic, $source ) { file { $name: owner => $owner, ... source => [ "${filedir}/${module}/${source}/host.${hostname}", "${filedir}/${module}/${source}/os.${operatingsystem}", "${filedir}/${module}/${source}/default" ]; } } Note the ${module} variable in there --- as it stands, i manually set that variable within each relevant class: class ntp::client { Config_file { module => "ntp", } ... } This is okay, but it would be better if there were a variable containing the name of the current module, so that i wouldn''t have to include that directive in every class. Thanks much. Chaos --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Mike Renfro
2008-Apr-10 17:39 UTC
[Puppet Users] Re: variable containing name of current module?
If a source is written like ''puppet:///ntp.conf'' in the module''s manifests, won''t the client automatically pull it from the module''s files folder? -- Mike Renfro / R&D Engineer, Center for Manufacturing Research 931 372-3601 / Tennessee Technological University -----Original Message----- From: Chaos Golubitsky <walrus-puppet@glassonion.org> Date: Thursday, Apr 10, 2008 12:08 pm Subject: [Puppet Users] variable containing name of current module? To: puppet-users@googlegroups.comReply-to: puppet-users@googlegroups.com>Does puppet export a variable containing the name of the module >currently being processed? That is, if i''m reading the file >"modules/ntp/manifests/whatever.pp", is there any puppet variable >containing the string "ntp"? > >That''s the entire question --- here''s the context in case it helps: > >I have a wrapper function which implements a search path for files: > > config_file(i > $owner = root, > ... > $module = generic, > $source > ) { > file { > $name: > owner => $owner, > ... > source => [ > "${filedir}/${module}/${source}/host.${hostname}", > "${filedir}/${module}/${source}/os.${operatingsystem}", > "${filedir}/${module}/${source}/default" > ]; > } > } > >Note the ${module} variable in there --- as it stands, i manually set that variable within each relevant class: > > class ntp::client { > Config_file { > module => "ntp", > } > ... > } > >This is okay, but it would be better if there were a variable containing the name of the current module, so that i wouldn''t have to include that directive in every class. > >Thanks much. > >Chaos > >> >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Luke Kanies
2008-Apr-10 17:47 UTC
[Puppet Users] Re: variable containing name of current module?
On Apr 10, 2008, at 12:39 PM, Mike Renfro wrote:> If a source is written like ''puppet:///ntp.conf'' in the module''s > manifests, won''t the client automatically pull it from the module''s > files folder?It needs to have ''ntp'' in it: ''puppet:///ntp/ntp.conf'' -- We are here on Earth to do good to others. What the others are here for, I don''t know. -- W. H. Auden --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.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 -~----------~----~----~----~------~----~------~--~---