Hi. I''m trying to configure puppet to manage logrotate, and decided to make a definition such as this: define logrotate(owner = root, group = root, mode = 0644, ensure file, size = "1MB", rotate = 5, source) { file { "logrotate_file": name => "/etc/logrotate.d/$title", content => template("logrotate-template.erb") } } I put this code in logrotate.pp. Next, I added this to the node configuration: logrotate { "test003.txt": source => "/home/kenneho/logtest.txt" } The logrotate-template.erb file looks like this: <%= source %> { missingok notifempty size <%= size %> rotate <%= rotate %> } When executing this configuration on the client I get an error message saying: "Tue May 20 13:06:45 +0200 2008 Puppet (err): Could not retrieve catalog: Failed to parse template logrotate-template.erb: Could not find value for ''source'' at /etc/puppet/manifests/classes/logrotate.pp: 6 on node <node>" I''m not sure where the error may be. Is it not allowd to call definitions directly from a node definition? Or must the definition be included in a class? Regards, kenneho --~--~---------~--~----~------------~-------~--~----~ 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> define logrotate(owner = root, group = root, mode = 0644, ensure > file, size = "1MB", rotate = 5, source) { > > file { "logrotate_file": > name => "/etc/logrotate.d/$title", > content => template("logrotate-template.erb") > } > > } > > I put this code in logrotate.pp. Next, I added this to the node > configuration: > > logrotate { "test003.txt": > source => "/home/kenneho/logtest.txt" > } > > > The logrotate-template.erb file looks like this: > > <%= source %> { > missingok > notifempty > size <%= size %> > rotate <%= rotate %> > } > > > When executing this configuration on the client I get an error message > saying: > "Tue May 20 13:06:45 +0200 2008 Puppet (err): Could not retrieve > catalog: Failed to parse template logrotate-template.erb: Could not > find value for ''source'' at /etc/puppet/manifests/classes/logrotate.pp: > 6 on node <node>" > > I''m not sure where the error may be. Is it not allowd to call > definitions directly from a node definition? Or must the definition be > included in a class?I rather supsect that your define is broken. If you didn''t change your define by pasting it to the mail, it should be: define logrotate($owner = root, $group = root, $mode = 0644, $ensure =file, $size = "1MB", $rotate = 5, $source) { [...] } this might lead to the actual error you see. greetings Pete --~--~---------~--~----~------------~-------~--~----~ 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 5/20/2008 7:03 AM, Peter Meier wrote:> I rather supsect that your define is broken. If you didn''t change your > define by pasting it to the mail, it should be: > > define logrotate($owner = root, $group = root, $mode = 0644, $ensure > =file, $size = "1MB", $rotate = 5, $source) { [...] } > > this might lead to the actual error you see.Use of ''source'' may be an issue, too, or at least odd, since source is already a built-in file attribute. http://reductivelabs.com/trac/puppet/wiki/TypeReference#file -- Mike Renfro / R&D Engineer, Center for Manufacturing Research, 931 372-3601 / Tennessee Technological University --~--~---------~--~----~------------~-------~--~----~ 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 20 Mai, 14:03, Peter Meier <peter.me...@immerda.ch> wrote:> I rather supsect that your define is broken. If you didn''t change your > define by pasting it to the mail, it should be: > > define logrotate($owner = root, $group = root, $mode = 0644, $ensure > =file, $size = "1MB", $rotate = 5, $source) { [...] } >This solved the problem. I referenced an example (page 52) in Turnbull''s Puppet book, and left out the "$" in the definition. But I see now that this was incorrect. In addition, I replaced the use of "source" with something else, just in case of issues here. Thanks for the help. Regards, kenneho --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---