Skip to content

Instantly share code, notes, and snippets.

@logicminds
Created May 1, 2014 15:22
Show Gist options
  • Save logicminds/5cc957ab4b0bdb91643a to your computer and use it in GitHub Desktop.
Save logicminds/5cc957ab4b0bdb91643a to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# first create the file with puppet just like sensu does
puppet apply --verbose -e 'file{"/tmp/testfile.txt": ensure => present, content => "foobar"}'
# now try to write to the file from ruby code (aka. the provide) just like puppet
cat > /tmp/providertest.rb << 'EOF'
#!/usr/bin/env ruby
File.open('/tmp/test2/testfile.txt', 'w').do |file|
file.write('hello world')
done
EOF
ruby /tmp/providertest.rb
/tmp/testfile.txt
/tmp/providertest.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment