On Thu, Apr 5, 2012 at 7:06 PM, vicki <vickiko...@gmail.com> wrote:
> Hi,
> 1) I added this test function tom my
> /etc/puppet/modules/write_line_to_file/lib/puppet/parser/functions/write_line_to_file.rb
> :
>
> module Puppet::Parser::Functions newfunction(:write_line_to_file) do |args|
>     filename = args[0]
>     str = args[1]
>     File.open(args[0], 'a') {|fd| fd.puts str }
>   end
> end
>
> 2) I invoked it in the
> /etc/puppet/modules/write_line_to_file/manifest/init.pp like this:
>
> class write_line_to_file{
> write_line_to_file('/tmp/some_file', "Hello world!")
> }
>
> 3) And I also included this module into my /etc/puppet/manifests/nodes.pp
> under the correct node:
> node default {}
> node 'testnode.domain.com'
> {
> include hosts
> include uninstall_screen
> include write_line_to_file
> }
>
> The function does execute, but on the puppetmaster - not on the remote node.
> Other two functions execute on the correct node. What am I missing?

Functions run on puppet master, facts and resource provider run on
puppet agent. Writing functions won't allow you to change puppet agent
files (unless you clone module and run puppet apply). If you are
trying to write line to a file either use augeas type or puppet
file_line from stdlib:

http://forge.puppetlabs.com/puppetlabs/stdlib

HTH,

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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to