Hi, are there any reserved words i''m not allowed to use in the puppet manifests? I have some strange errors that came up using puppet manifests with variables like - $string - $type - $label After changing these variable names everything worked as expected. Best... Uwe -- 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 Tue, Jan 11, 2011 at 1:36 AM, Uwe Bartels <uwe.bartels@gmail.com> wrote:> Hi, > > are there any reserved words i''m not allowed to use in the puppet > manifests? > I have some strange errors that came up using puppet manifests with > variables like > - $string > - $type > - $label >The are special variables, not reserved words: also $module_name, $title, $name, $caller_module_name> After changing these variable names everything worked as expected. > > Best... > Uwe > > -- > 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<puppet-users%2Bunsubscribe@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. >-- 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 Jan 11, 2011 8:58 AM, "Dan Bode" <dan@puppetlabs.com> wrote:> On Tue, Jan 11, 2011 at 1:36 AM, Uwe Bartels <uwe.bartels@gmail.com>wrote:>> are there any reserved words i''m not allowed to use in the puppetmanifests?>> I have some strange errors that came up using puppet manifests withvariables like>> - $string >> - $type >> - $label > > The are special variables, not reserved words: > also $module_name, $title, $name, $caller_module_nameHowever, watch out that any name exported by the Ruby "Kernel" module is unavailable in an erb template - they invoke the Ruby method instead. (This is nasty for, say, the ''fork'' variable in the template.) While it doesn''t sound like that was your problem, it has caught me out more than once. Regards, Daniel -- 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 Tue, Jan 11, 2011 at 9:59 AM, Daniel Pittman <daniel@rimspace.net> wrote:> On Jan 11, 2011 8:58 AM, "Dan Bode" <dan@puppetlabs.com> wrote: > > On Tue, Jan 11, 2011 at 1:36 AM, Uwe Bartels <uwe.bartels@gmail.com> > wrote: > > >> are there any reserved words i''m not allowed to use in the puppet > manifests? > >> I have some strange errors that came up using puppet manifests with > variables like > >> - $string > >> - $type > >> - $label > > > > The are special variables, not reserved words: > > also $module_name, $title, $name, $caller_module_name > > However, watch out that any name exported by the Ruby "Kernel" module is > unavailable in an erb template - they invoke the Ruby method instead. (This > is nasty for, say, the ''fork'' variable in the template.) > > feel free to vote on http://projects.puppetlabs.com/issues/5489, I had thesame problem, but with a function called y> While it doesn''t sound like that was your problem, it has caught me out > more than once. > > Regards, > Daniel > > -- > 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<puppet-users%2Bunsubscribe@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. >-- 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.
Why not simple render templates with puppet with safemode templating [1]? this will avoid things like <%= File.read "/etc/shadow" %> and such, additionally, it can whitelist which params are allowed to be accessed within the template. I started using it within Foreman recently, and I find it very useful. Ohad [1] - https://github.com/svenfuchs/safemode#readme On Tue, Jan 11, 2011 at 8:15 PM, Dan Bode <dan@puppetlabs.com> wrote:> > > On Tue, Jan 11, 2011 at 9:59 AM, Daniel Pittman <daniel@rimspace.net>wrote: > >> On Jan 11, 2011 8:58 AM, "Dan Bode" <dan@puppetlabs.com> wrote: >> > On Tue, Jan 11, 2011 at 1:36 AM, Uwe Bartels <uwe.bartels@gmail.com> >> wrote: >> >> >> are there any reserved words i''m not allowed to use in the puppet >> manifests? >> >> I have some strange errors that came up using puppet manifests with >> variables like >> >> - $string >> >> - $type >> >> - $label >> > >> > The are special variables, not reserved words: >> > also $module_name, $title, $name, $caller_module_name >> >> However, watch out that any name exported by the Ruby "Kernel" module is >> unavailable in an erb template - they invoke the Ruby method instead. (This >> is nasty for, say, the ''fork'' variable in the template.) >> >> feel free to vote on http://projects.puppetlabs.com/issues/5489, I had > the same problem, but with a function called y > > >> While it doesn''t sound like that was your problem, it has caught me out >> more than once. >> >> Regards, >> Daniel >> >> -- >> 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<puppet-users%2Bunsubscribe@googlegroups.com> >> . >> For more options, visit this group at >> http://groups.google.com/group/puppet-users?hl=en. >> > > -- > 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<puppet-users%2Bunsubscribe@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. >-- 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 Tue, Jan 11, 2011 at 10:44, Ohad Levy <ohadlevy@gmail.com> wrote:> Why not simple render templates with puppet with safemode templating [1]?Last time I looked I didn''t find this, if it was available. That was several major versions back though.> this will avoid things like <%= File.read "/etc/shadow" %> and such, > additionally, it can whitelist which params are allowed to > be accessed within the template.Hrm. One of the ... useful by coincidence features of templates is that they can do a lot more than native code, for better or worse. I don''t object, but I suspect there is a design decision in there. It would be nice if you could add that suggestion to the ticket, though; if you don''t I will get to it some time.... :) Regards, Daniel -- ✉ Daniel Pittman <daniel@rimspace.net> ⌨ daniel@rimspace.net (XMPP) ☎ +1 503 893 2285 ♻ made with 100 percent post-consumer electrons -- 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 11 January 2011 22:27, Dan Bode <dan@puppetlabs.com> wrote:> > > On Tue, Jan 11, 2011 at 1:36 AM, Uwe Bartels <uwe.bartels@gmail.com> wrote:[...]> > The are special variables, not reserved words: > > also $module_name, $title, $name, $caller_module_nameHi Dan, (sorry for the minor thread-hijack) What''s the difference between $module_name and $caller_module_name? When I was attempting to use a parser function[1] I wrote to simplify my argument to the source param in file resources, I tried to assign $module_name to the name of the module and use lookupfile($module_name, "cluebringer.conf") and got:> err: Could not retrieve catalog from remote server: Error 400 on SERVER: Cannot reassign variable module_name at /etc/puppet/modules/cbpolicyd/manifests/init.pp:15 on node outbound-us2I didn''t know/follow that it was due to $module_name being a special variable. I had this in my module: class cbpolicyd { $module_name = "cbpolicyd" file { "/etc/policyd/cluebringer.conf": group => root, mode => 0644, source => lookupfile($module_name, "cluebringer.conf"), require => Package["cluebringer"], notify => Service["cbpolicyd"]; } ... multiple file resources ... } Now I think I might be able to simplify lookupfile() by assuming $module_name (or $caller_module_name) as an implicit argument within lookupfile.rb[1] and thereby having to just use:> source => lookupfile("cluebringer.conf")-Naresh [1]: http://dpaste.com/hold/308475/ -- 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 Tue, Jan 11, 2011 at 7:47 PM, Naresh V <nareshov@gmail.com> wrote:> On 11 January 2011 22:27, Dan Bode <dan@puppetlabs.com> wrote: > > > > > > On Tue, Jan 11, 2011 at 1:36 AM, Uwe Bartels <uwe.bartels@gmail.com> > wrote: > [...] > > > > The are special variables, not reserved words: > > > > also $module_name, $title, $name, $caller_module_name > > Hi Dan, > > (sorry for the minor thread-hijack) > > What''s the difference between $module_name and $caller_module_name? > When I was attempting to use a parser function[1] I wrote to simplify > my argument to the source param in file resources, I tried to assign > $module_name to the name of the module and use > lookupfile($module_name, "cluebringer.conf") and got: > > > err: Could not retrieve catalog from remote server: Error 400 on SERVER: > Cannot reassign variable module_name at > /etc/puppet/modules/cbpolicyd/manifests/init.pp:15 on node outbound-us2 > > I didn''t know/follow that it was due to $module_name being a special > variable. I had this in my module: > > class cbpolicyd { > $module_name = "cbpolicyd" >this is the offending line, you don''t have to specify this, it should already be set. try putting a notice($module_name) here> file { > "/etc/policyd/cluebringer.conf": > group => root, > mode => 0644, > source => lookupfile($module_name, "cluebringer.conf"), > require => Package["cluebringer"], > notify => Service["cbpolicyd"]; > } > ... multiple file resources ... > } > > Now I think I might be able to simplify lookupfile() by assuming > $module_name (or $caller_module_name) as an implicit argument within > lookupfile.rb[1] and thereby having to just use: > > > source => lookupfile("cluebringer.conf") > > > -Naresh > > [1]: http://dpaste.com/hold/308475/ > > -- > 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<puppet-users%2Bunsubscribe@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > >-- 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.