summaryrefslogtreecommitdiff
path: root/lib/puppet/provider/file_line/ruby.rb
blob: 63bbd8e819b9c125b717d78ad2e12cc4c51a5d95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Puppet::Type.type(:file_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