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...@googlegroups.com.
To unsubscribe from this group, send email to puppet-users...@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" <d...@puppetlabs.com> wrote:
> On Tue, Jan 11, 2011 at 1:36 AM, Uwe Bartels <uwe.b...@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.)
While it doesn't sound like that was your problem, it has caught me out more than once.
Regards,
Daniel
On Jan 11, 2011 8:58 AM, "Dan Bode" <d...@puppetlabs.com> wrote:
> On Tue, Jan 11, 2011 at 1:36 AM, Uwe Bartels <uwe.b...@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_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
--
> 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 <dan...@rimspace.net>
⌨ dan...@rimspace.net (XMPP)
☎ +1 503 893 2285
♻ made with 100 percent post-consumer electrons
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"
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
On 11 January 2011 22:27, Dan Bode <d...@puppetlabs.com> wrote:[...]
>
>
> On Tue, Jan 11, 2011 at 1:36 AM, Uwe Bartels <uwe.b...@gmail.com> wrote:
>Hi Dan,
> The are special variables, not reserved words:
>
> also $module_name, $title, $name, $caller_module_name
(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"
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/