4c93090e1a
Without this patch the resource whole_line would be included in the stable stdlib module shipping in PE 1.2. Ideally the name will be stable and unchanging in the future. There was quite a bit of concern over whole_line being an unwise name. file_line appears to be the most suitable name and least likely to need another rename in the future.
15 lines
277 B
Ruby
15 lines
277 B
Ruby
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
|