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 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 Sat, Feb 12, 2011 at 9:06 AM, flex <frostynova@gmail.com> 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:14What version of puppet are you using? This is limited to 2.6.x.> 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?$name is in scope within {..}. However this is fixed in 5061 which will be released in 2.6.5 (currently rc2): http://projects.puppetlabs.com/issues/5061 Thanks, Nan -- 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.
my puppet version is 2.6.2 2011/2/13 Nan Liu <nan@puppetlabs.com>> On Sat, Feb 12, 2011 at 9:06 AM, flex <frostynova@gmail.com> 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 > > What version of puppet are you using? This is limited to 2.6.x. > > > 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? > > $name is in scope within {..}. However this is fixed in 5061 which > will be released in 2.6.5 (currently rc2): > http://projects.puppetlabs.com/issues/5061 > > Thanks, > > Nan > > -- > 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. > >-- 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 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.
by the way, the $module_name is set correctly, but seems it can not be pass to a define like this: redarrow::add {test_portage: module => $module_name} 2011/2/13 flex <frostynova@gmail.com>> my puppet version is 2.6.2 > > 2011/2/13 Nan Liu <nan@puppetlabs.com> > > On Sat, Feb 12, 2011 at 9:06 AM, flex <frostynova@gmail.com> 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 >> >> What version of puppet are you using? This is limited to 2.6.x. >> >> > 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? >> >> $name is in scope within {..}. However this is fixed in 5061 which >> will be released in 2.6.5 (currently rc2): >> http://projects.puppetlabs.com/issues/5061 >> >> Thanks, >> >> Nan >> >> -- >> 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. >> >> > > > -- > System Administrator, Focus on System Management and Basic Development >-- 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 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.
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 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.
I am so sorry to reply until now, yes, the notify and the ${caller_module_name} are also the right value, thank you very much! 2011/2/16 Felix Frank <felix.frank@alumni.tu-berlin.de>> 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 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. > >-- 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 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.