summaryrefslogtreecommitdiff
path: root/lib/puppet
diff options
context:
space:
mode:
authortphoney <tp@puppet.com>2017-07-03 17:08:09 +0100
committertphoney <tp@puppet.com>2017-07-03 17:08:09 +0100
commit58131d8ff1886352e964aafef58ffeb65c5d2cdd (patch)
tree58fca90257dd2606c3fc006574134080b8929440 /lib/puppet
parent517a133209a0b0f8741029c247fea595b50d801e (diff)
(MODULES-5003) file_line fix all broken lines
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/provider/file_line/ruby.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/puppet/provider/file_line/ruby.rb b/lib/puppet/provider/file_line/ruby.rb
index 42f287a..1d27424 100644
--- a/lib/puppet/provider/file_line/ruby.rb
+++ b/lib/puppet/provider/file_line/ruby.rb
@@ -1,16 +1,21 @@
Puppet::Type.type(:file_line).provide(:ruby) do
def exists?
+ found = true
if resource[:replace].to_s != 'true' and count_matches(match_regex) > 0
- true
+ found = true
else
lines.find do |line|
if resource[:ensure].to_s == 'absent' and resource[:match_for_absence].to_s == 'true'
- line.chomp =~ Regexp.new(resource[:match])
+ found = line.chomp =~ Regexp.new(resource[:match])
else
- line.chomp == resource[:line].chomp
+ found = line.chomp == resource[:line].chomp
+ end
+ if found == false then
+ break
end
end
end
+ found
end
def create