Hi,
have you tried adding 'notify { "Caller module=$caller_module_name": }'
to various classes/defines in the redarrow module?
Also (although this is somewhat dumb), have you tried
"puppet:///modules/${caller_module_name}/redarrow.conf" instead?
Curly braces shouldn't be necessary there, but something definitely
smells, so...
Regards,
Felix
On 02/12/2011 06:06 PM, flex wrote:
> This is my puppet script:
>
> modules/redarrow/manifests/add.pp:
>
> define redarrow::add($type = "file") {
> file { "/etc/redarrow.conf/$name.conf":
> owner => "root",
> group => "root",
> mode => 644,
> source => $type ? {
> "file" => "puppet:///modules/$caller_module_name/redarrow.conf",
> default => undef,
> },
> content => $type ? {
> "template" => template("$caller_module_name/redarrow.erb"),
> default => undef,
> },
> }
> }
>
> modules/portage/manifests/init.pp:
>
> redarrow::add {test_portage: }
>
> Result:
> (/Stage[main]/Portage/Redarrow::Add[test_portage]/File[/etc/redarrow.conf/test_portage.conf])
> Could not evaluate: Error 400 on SERVER: Invalid module name; module
> names must be alphanumeric (plus '-'), not 'redarrow.conf' Could not
> retrieve file metadata for puppet:///modules//redarrow.conf: Error 400
> on SERVER: Invalid module name; module names must be alphanumeric (plus
> '-'), not 'redarrow.conf' at
> /home/flex/puppet/modules/redarrow/manifests/add.pp:14
>
> It seems that the variable $caller_module_name is not set, then i found
> another stange thing, i got what i want like this:
>
> define redarrow::add($module = $name, $type = "file") {
> file { "/etc/redarrow.conf/$name.conf":
> owner => "root",
> group => "root",
> mode => 644,
> source => $type ? {
> "file" => "puppet:///modules/$module/redarrow.conf",
> default => undef,
> },
> content => $type ? {
> "template" => template("$module/redarrow.erb"),
> default => undef,
> },
> }
> }
>
> the $name in varaible list of the define is not the same as the $name
> below which is the resource name, it is this a bug or a hidden feature?
--
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.