CraftyTech
2011-Oct-14 05:07 UTC
[Puppet Users] defined resource type not working in 2.7.5
Hello All, I''m having problems getting a simple defined resource type work. Here''s an example of what I''m trying to run: class app_deployer2 { define fil($ensure) { file {$name: content => "this is a test" } } fil { "File1" :ensure => "/tmp/file1" } } # But when I run it, I keep on geting error: "err: Failed to apply catalog: Parameter path failed: File paths must be fully qualified, not ''File1'' at /etc/puppet/modules/app_deployer2/manifests/init.pp:5" As far as I can tell, this should work, but is not. Can anyone see what I''m missing? Thanks, -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/PpYd3Zoy2DMJ. 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.
CraftyTech
2011-Oct-14 05:19 UTC
[Puppet Users] Re: defined resource type not working in 2.7.5
This is the whole file: class app_deployer2 { define fil($ensure= "present", $path) { file {$name: content => "this is a test" } } fil { "File1": path => "/tmp/file1" } } # and this is the error message I keep on getting: "err: Failed to apply catalog: Parameter path failed: File paths must be fully qualified, not ''File1'' at /etc/puppet/modules/app_deployer2/manifests/init.pp:5" Thanks, -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/OQYJ1wm1fBMJ. 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.
Rob Sweet
2011-Oct-14 12:20 UTC
[Puppet Users] Re: defined resource type not working in 2.7.5
It looks like you''re passing in the path parameter but not using it within your file declaration inside the define. Without a path, Puppet needs the name parameter to have a full path. Add ''path => $path'' to your file resource and see if that gets you working. Rob On Oct 14, 12:19 am, CraftyTech <hmmed...@gmail.com> wrote:> This is the whole file: > class app_deployer2 { > > define fil($ensure= "present", $path) { file {$name: > content => "this is a test" > } > } > > fil { "File1": path => "/tmp/file1" } > > } > > # > and this is the error message I keep on getting: > "err: Failed to apply catalog: Parameter path failed: File paths must be > fully qualified, not ''File1'' at > /etc/puppet/modules/app_deployer2/manifests/init.pp:5" > > Thanks,-- 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.
Nan Liu
2011-Oct-14 18:59 UTC
Re: [Puppet Users] Re: defined resource type not working in 2.7.5
On Fri, Oct 14, 2011 at 5:20 AM, Rob Sweet <rhsweet@gmail.com> wrote:> It looks like you''re passing in the path parameter but not using it > within your file declaration inside the define. Without a path, Puppet > needs the name parameter to have a full path. Add ''path => $path'' to > your file resource and see if that gets you working. > > Rob > > On Oct 14, 12:19 am, CraftyTech <hmmed...@gmail.com> wrote: >> This is the whole file: >> class app_deployer2 { >> >> define fil($ensure= "present", $path) { file {$name: >> content => "this is a test" >> } >> }In addition to what Rob mentioned, $name gets translate to the title of the resource, which is "File1". So if you meant to do support something similar to puppet resource where you have a namevar and it defaults to the title, unless you specify namevar (example below is path) write it this way: define my_file ($path = $name, $content) { file { $name: path => $path, content => $content, } } This is supported starting 2.6.5+ with the fix of #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.
CraftyTech
2011-Oct-15 12:01 UTC
Re: [Puppet Users] Re: defined resource type not working in 2.7.5
that worked. Thanks, -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/yzKUrbktqFwJ. 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.