On 11 January 2011 22:27, Dan Bode <[email protected]> wrote:
>
>
> On Tue, Jan 11, 2011 at 1:36 AM, Uwe Bartels <[email protected]> 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"

  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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to