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?
--
System Administrator, Focus on System Management and Basic Development
--
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.