Hi, I needed a function to check if a file is existing on the Debian box I am configuring. So I used this one module Puppet::Parser::Functions newfunction(:file_exists, :type => :rvalue) do |args| if File.exists?(args[0]) return 1 else return 0 end end end It work greats for some service where apache2 doesn''t work for me. I am using it this way "file_exists(''/etc/init.d/apache2'') == 1" if this return true I will stop the service or do nothing. In my case, the file /etc/init.d/apache2 exists on the puppet master running through Passenger, but the puppet client doesn''t have it. But when I run the puppetd -vt it returns me an error because it''s thinking the file /etc/init.d/apache2 exists on the puppet client and tries to stop the service. do you have any idea, is there a caching system on puppet client where we could delete a cached function? Thank you! -- 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 there, So, functions will ALWAYS be executed on the Puppet MASTER server. They''re never executed on the client. This is why you''re seeing the behavior that you do. On Wed, Feb 22, 2012 at 12:00 PM, DRivard <dominick.rivard@gmail.com> wrote:> Hi, > > I needed a function to check if a file is existing on the Debian box I > am configuring. So I used this one > > module Puppet::Parser::Functions > newfunction(:file_exists, :type => :rvalue) do |args| > if File.exists?(args[0]) > return 1 > else > return 0 > end > end > end > > It work greats for some service where apache2 doesn''t work for me. > I am using it this way "file_exists(''/etc/init.d/apache2'') == 1" if > this return true I will stop the service or do nothing. > In my case, the file /etc/init.d/apache2 exists on the puppet master > running through Passenger, but the puppet client doesn''t have it. > But when I run the puppetd -vt it returns me an error because it''s > thinking the file /etc/init.d/apache2 exists on the puppet client and > tries to stop the service. > > do you have any idea, is there a caching system on puppet client where > we could delete a cached function? > > Thank you! > > -- > 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. > >-- Gary Larizza Professional Services Engineer Puppet 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.
What is the purpose of running such function if they are not running on the client? On Feb 22, 3:22 pm, Gary Larizza <g...@puppetlabs.com> wrote:> Hi there, > > So, functions will ALWAYS be executed on the Puppet MASTER server. They''re > never executed on the client. This is why you''re seeing the behavior that > you do. > > > > > > > > > > On Wed, Feb 22, 2012 at 12:00 PM, DRivard <dominick.riv...@gmail.com> wrote: > > Hi, > > > I needed a function to check if a file is existing on the Debian box I > > am configuring. So I used this one > > > module Puppet::Parser::Functions > > newfunction(:file_exists, :type => :rvalue) do |args| > > if File.exists?(args[0]) > > return 1 > > else > > return 0 > > end > > end > > end > > > It work greats for some service where apache2 doesn''t work for me. > > I am using it this way "file_exists(''/etc/init.d/apache2'') == 1" if > > this return true I will stop the service or do nothing. > > In my case, the file /etc/init.d/apache2 exists on the puppet master > > running through Passenger, but the puppet client doesn''t have it. > > But when I run the puppetd -vt it returns me an error because it''s > > thinking the file /etc/init.d/apache2 exists on the puppet client and > > tries to stop the service. > > > do you have any idea, is there a caching system on puppet client where > > we could delete a cached function? > > > Thank you! > > > -- > > 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. > > -- > > Gary Larizza > Professional Services Engineer > Puppet 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, Feb 22, 2012 at 12:27 PM, DRivard <dominick.rivard@gmail.com> wrote:> What is the purpose of running such function if they are not running > on the client? >* Parsing/munging data in the manifests * Collecting data from an external source to use in manifests * Running a command on the master It sounds like you want a custom fact instead of a function.> > On Feb 22, 3:22 pm, Gary Larizza <g...@puppetlabs.com> wrote: > > Hi there, > > > > So, functions will ALWAYS be executed on the Puppet MASTER server. > They''re > > never executed on the client. This is why you''re seeing the behavior > that > > you do. > > > > > > > > > > > > > > > > > > > > On Wed, Feb 22, 2012 at 12:00 PM, DRivard <dominick.riv...@gmail.com> > wrote: > > > Hi, > > > > > I needed a function to check if a file is existing on the Debian box I > > > am configuring. So I used this one > > > > > module Puppet::Parser::Functions > > > newfunction(:file_exists, :type => :rvalue) do |args| > > > if File.exists?(args[0]) > > > return 1 > > > else > > > return 0 > > > end > > > end > > > end > > > > > It work greats for some service where apache2 doesn''t work for me. > > > I am using it this way "file_exists(''/etc/init.d/apache2'') == 1" if > > > this return true I will stop the service or do nothing. > > > In my case, the file /etc/init.d/apache2 exists on the puppet master > > > running through Passenger, but the puppet client doesn''t have it. > > > But when I run the puppetd -vt it returns me an error because it''s > > > thinking the file /etc/init.d/apache2 exists on the puppet client and > > > tries to stop the service. > > > > > do you have any idea, is there a caching system on puppet client where > > > we could delete a cached function? > > > > > Thank you! > > > > > -- > > > 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. > > > > -- > > > > Gary Larizza > > Professional Services Engineer > > Puppet 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. > >-- Nigel Kersten Product Manager, Puppet 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.
As Nigel said, custom FACTS will be run on the client side (only), and so you can create a custom fact that will give you what you need. Check out the documentation if you need some more help with that --> http://docs.puppetlabs.com/guides/custom_facts.html On Wed, Feb 22, 2012 at 12:27 PM, DRivard <dominick.rivard@gmail.com> wrote:> What is the purpose of running such function if they are not running > on the client? > > On Feb 22, 3:22 pm, Gary Larizza <g...@puppetlabs.com> wrote: > > Hi there, > > > > So, functions will ALWAYS be executed on the Puppet MASTER server. > They''re > > never executed on the client. This is why you''re seeing the behavior > that > > you do. > > > > > > > > > > > > > > > > > > > > On Wed, Feb 22, 2012 at 12:00 PM, DRivard <dominick.riv...@gmail.com> > wrote: > > > Hi, > > > > > I needed a function to check if a file is existing on the Debian box I > > > am configuring. So I used this one > > > > > module Puppet::Parser::Functions > > > newfunction(:file_exists, :type => :rvalue) do |args| > > > if File.exists?(args[0]) > > > return 1 > > > else > > > return 0 > > > end > > > end > > > end > > > > > It work greats for some service where apache2 doesn''t work for me. > > > I am using it this way "file_exists(''/etc/init.d/apache2'') == 1" if > > > this return true I will stop the service or do nothing. > > > In my case, the file /etc/init.d/apache2 exists on the puppet master > > > running through Passenger, but the puppet client doesn''t have it. > > > But when I run the puppetd -vt it returns me an error because it''s > > > thinking the file /etc/init.d/apache2 exists on the puppet client and > > > tries to stop the service. > > > > > do you have any idea, is there a caching system on puppet client where > > > we could delete a cached function? > > > > > Thank you! > > > > > -- > > > 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. > > > > -- > > > > Gary Larizza > > Professional Services Engineer > > Puppet 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. > >-- Gary Larizza Professional Services Engineer Puppet 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.