diff options
author | Jeff McCune <jeff@puppetlabs.com> | 2011-08-04 17:58:05 -0700 |
---|---|---|
committer | Jeff McCune <jeff@puppetlabs.com> | 2011-08-04 17:58:05 -0700 |
commit | ee1081571e5926c6ac90158160b7a0e241cfa54c (patch) | |
tree | 05f203aed2a006f040e0fa23e6876817663b3f92 /lib/puppet/provider/whole_line/ruby.rb | |
parent | 0466e1bc6fc1864501ef380d0ca10eda98ee24dc (diff) | |
parent | 4540949d96608c6ff7eed07d53294337446fbead (diff) |
Merge branch 'refactor/master/8665_whole_line'
* refactor/master/8665_whole_line:
(#8665) Change type from append_line to whole_line
Diffstat (limited to 'lib/puppet/provider/whole_line/ruby.rb')
-rw-r--r-- | lib/puppet/provider/whole_line/ruby.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/puppet/provider/whole_line/ruby.rb b/lib/puppet/provider/whole_line/ruby.rb new file mode 100644 index 0000000..156f255 --- /dev/null +++ b/lib/puppet/provider/whole_line/ruby.rb @@ -0,0 +1,15 @@ +Puppet::Type.type(:whole_line).provide(:ruby) do + + def exists? + File.readlines(resource[:path]).find do |line| + line.chomp == resource[:line].chomp + end + end + + def create + File.open(resource[:path], 'a') do |fh| + fh.puts resource[:line] + end + end + +end |