Hello, I''m trying to do almost exactly what the cookbook at http://reductivelabs.com/trac/puppet/wiki/WritingYourOwnFunctions is doing, namely, adding a custom hash function to determine what time cron should run. However, I can''t get puppet to find my function. I''ve got it symlinked all over: [root@nagios1 functions]# puppetmasterd --configprint libdir /var/lib/puppet/lib [root@nagios1 functions]# ls /var/lib/puppet/lib/puppet/parser/ functions/functions.rb /var/lib/puppet/lib/puppet/parser/functions/functions.rb [root@nagios1 functions]# ls /etc/puppet/modules/puppet/plugins/puppet/ parser/functions/functions.rb /etc/puppet/modules/puppet/plugins/puppet/parser/functions/ functions.rb The conents of the file are: require ''digest/sha1'' module Puppet::Parser::Functions newfunction(:minute_from_address, :type => :rvalue) do |args| Digest::SHA1.hexdigest(lookupvar(''ipaddress'')).hex.to_i % 60 end end And the recipe calling it is: class puppet { cron { puppet: command => "/etc/init.d/puppet once", user => root, minute => minute_from_address() } } But all I ever get is: Aug 4 22:29:19 toolbox puppetd[10730]: Could not retrieve catalog: Unknown function minute_from_address at /etc/puppet/modules/puppet/ manifests/init.pp:16 on node xyz Can someone tell me what I''m doing wrong here? According to the link referenced above, puppet should be picking up functions in these directories. Even better, is there an accepted way I can tell puppetmasterd to look for functions in a particular place? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> > > Can someone tell me what I''m doing wrong here? According to the link > referenced above, puppet should be picking up functions in these > directories. Even better, is there an accepted way I can tell > puppetmasterd to look for functions in a particular place?Hi I assumed your issue is related to this? http://projects.reductivelabs.com/issues/2494 -L -- Larry Ludwig Reductive Labs --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Perhaps this is the same issue, but the workaround does not seem to work. Starting puppetmasterd with --libdir=/var/lib/puppet/lib does not fix the problem. On Aug 5, 9:13 pm, Larry Ludwig <la...@reductivelabs.com> wrote:> > Can someone tell me what I''m doing wrong here? According to the link > > referenced above, puppet should be picking up functions in these > > directories. Even better, is there an accepted way I can tell > > puppetmasterd to look for functions in a particular place? > > Hi I assumed your issue is related to this? > > http://projects.reductivelabs.com/issues/2494 > > -L > > -- > Larry Ludwig > Reductive Labs--~--~---------~--~----~------------~-------~--~----~ 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 Wed, Aug 5, 2009 at 12:47 PM, Ben Lavender <blavender@gmail.com> wrote:> > Perhaps this is the same issue, but the workaround does not seem to > work. Starting puppetmasterd with --libdir=/var/lib/puppet/lib does > not fix the problem.Silly question, but this bit me: are you running both puppetmaster and client with --pluginsync? -Shawn> > > On Aug 5, 9:13 pm, Larry Ludwig <la...@reductivelabs.com> wrote: > > > Can someone tell me what I''m doing wrong here? According to the link > > > referenced above, puppet should be picking up functions in these > > > directories. Even better, is there an accepted way I can tell > > > puppetmasterd to look for functions in a particular place? > > > > Hi I assumed your issue is related to this? > > > > http://projects.reductivelabs.com/issues/2494 > > > > -L > > > > -- > > Larry Ludwig > > Reductive Labs > > >--~--~---------~--~----~------------~-------~--~----~ 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 Wed, Aug 5, 2009 at 5:26 PM, S H <shdashbeta@gmail.com> wrote:> On Wed, Aug 5, 2009 at 12:47 PM, Ben Lavender <blavender@gmail.com> wrote: > >> >> Perhaps this is the same issue, but the workaround does not seem to >> work. Starting puppetmasterd with --libdir=/var/lib/puppet/lib does >> not fix the problem. > > > Silly question, but this bit me: are you running both puppetmaster and > client with --pluginsync? > > -Shawn >Pretend I didn''t ask that. Functions only run on the puppetmaster. Nothing to see here. -Shawn> > > > >> >> >> On Aug 5, 9:13 pm, Larry Ludwig <la...@reductivelabs.com> wrote: >> > > Can someone tell me what I''m doing wrong here? According to the link >> > > referenced above, puppet should be picking up functions in these >> > > directories. Even better, is there an accepted way I can tell >> > > puppetmasterd to look for functions in a particular place? >> > >> > Hi I assumed your issue is related to this? >> > >> > http://projects.reductivelabs.com/issues/2494 >> > >> > -L >> > >> > -- >> > Larry Ludwig >> > Reductive Labs >> >> >> >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Actually, I take that back--it would not appear to be the same issue as #2494 at all. I also have the functions file in this directory: /etc/puppet/modules/puppet/plugins/puppet/parser/functions/ That should have been loaded as well, according to http://reductivelabs.com/trac/puppet/wiki/WritingYourOwnFunctions , but it was not. I''m starting to worry that I''m missing something terribly simple and obvious. Ben On Aug 6, 1:47 am, Ben Lavender <blaven...@gmail.com> wrote:> Perhaps this is the same issue, but the workaround does not seem to > work. Starting puppetmasterd with --libdir=/var/lib/puppet/lib does > not fix the problem. > > On Aug 5, 9:13 pm, Larry Ludwig <la...@reductivelabs.com> wrote: > > > > > > Can someone tell me what I''m doing wrong here? According to the link > > > referenced above, puppet should be picking up functions in these > > > directories. Even better, is there an accepted way I can tell > > > puppetmasterd to look for functions in a particular place? > > > Hi I assumed your issue is related to this? > > >http://projects.reductivelabs.com/issues/2494 > > > -L > > > -- > > Larry Ludwig > > Reductive Labs--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Is there a solution to this? --- Thanks, Allan Marcus 505-667-5666 On Aug 5, 2009, at 10:52 PM, Ben Lavender wrote:> > Actually, I take that back--it would not appear to be the same issue > as #2494 at all. > > I also have the functions file in this directory: > /etc/puppet/modules/puppet/plugins/puppet/parser/functions/ > > That should have been loaded as well, according to > http://reductivelabs.com/trac/puppet/wiki/WritingYourOwnFunctions , > but it was not. I''m starting to worry that I''m missing something > terribly simple and obvious. > > Ben > > On Aug 6, 1:47 am, Ben Lavender <blaven...@gmail.com> wrote: >> Perhaps this is the same issue, but the workaround does not seem to >> work. Starting puppetmasterd with --libdir=/var/lib/puppet/lib does >> not fix the problem. >> >> On Aug 5, 9:13 pm, Larry Ludwig <la...@reductivelabs.com> wrote: >> >> >> >>>> Can someone tell me what I''m doing wrong here? According to the >>>> link >>>> referenced above, puppet should be picking up functions in these >>>> directories. Even better, is there an accepted way I can tell >>>> puppetmasterd to look for functions in a particular place? >> >>> Hi I assumed your issue is related to this? >> >>> http://projects.reductivelabs.com/issues/2494 >> >>> -L >> >>> -- >>> Larry Ludwig >>> Reductive Labs > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Just so that it gets onto the mailing list for the next poor guy searching for this: Functions need to be in a file of the same name, it would appear. I can find nothing in the wiki that mentions this specifically, but perhaps I did not look hard enough. I renamed my file from functions.rb to minute_from_address.rb and it worked immediately. The location of the file, /etc/puppet/modules/ puppet/plugins/puppet/parser/functions/ , was evidently fine the whole time. Ben On Aug 12, 7:58 pm, Allan Marcus <al...@lanl.gov> wrote:> Is there a solution to this? > > --- > Thanks, > > Allan Marcus > 505-667-5666 > > On Aug 5, 2009, at 10:52 PM, Ben Lavender wrote: > > > > > > > Actually, I take that back--it would not appear to be the same issue > > as #2494 at all. > > > I also have the functions file in this directory: > > /etc/puppet/modules/puppet/plugins/puppet/parser/functions/ > > > That should have been loaded as well, according to > >http://reductivelabs.com/trac/puppet/wiki/WritingYourOwnFunctions, > > but it was not. I''m starting to worry that I''m missing something > > terribly simple and obvious. > > > Ben > > > On Aug 6, 1:47 am, Ben Lavender <blaven...@gmail.com> wrote: > >> Perhaps this is the same issue, but the workaround does not seem to > >> work. Starting puppetmasterd with --libdir=/var/lib/puppet/lib does > >> not fix the problem. > > >> On Aug 5, 9:13 pm, Larry Ludwig <la...@reductivelabs.com> wrote: > > >>>> Can someone tell me what I''m doing wrong here? According to the > >>>> link > >>>> referenced above, puppet should be picking up functions in these > >>>> directories. Even better, is there an accepted way I can tell > >>>> puppetmasterd to look for functions in a particular place? > > >>> Hi I assumed your issue is related to this? > > >>>http://projects.reductivelabs.com/issues/2494 > > >>> -L > > >>> -- > >>> Larry Ludwig > >>> Reductive Labs--~--~---------~--~----~------------~-------~--~----~ 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 9/15/09, Ben Lavender <blavender@gmail.com> wrote:> > > I renamed my file from functions.rb to minute_from_address.rb and itLike a function that converts your ip address into a "random" value? see http://reductivelabs.com/trac/puppet/wiki/Recipes/cron in the Setting Cron using a Puppet custom function :) Ohad --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
James Turnbull
2009-Sep-15 09:19 UTC
[Puppet Users] Re: Puppet cannot find custom functions
2009/9/15 Ben Lavender <blavender@gmail.com>:> > Just so that it gets onto the mailing list for the next poor guy > searching for this: > > Functions need to be in a file of the same name, it would appear. I > can find nothing in the wiki that mentions this specifically, but > perhaps I did not look hard enough.It''s in: http://reductivelabs.com/trac/puppet/wiki/WritingYourOwnFunctions "The name of the file you put your function into must be the same as the name of function, otherwise it won''t get automatically loaded. This ''''will'''' bite you some day." Regards James Turnbull -- Author of: * Pro Linux Systems Administration (http://tinyurl.com/linuxadmin) * Pulling Strings with Puppet (http://tinyurl.com/pupbook) * Pro Nagios 2.0 (http://tinyurl.com/pronagios) * Hardening Linux (http://tinyurl.com/hardeninglinux) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---