summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEric Putnam <putnam.eric@gmail.com>2017-07-07 09:38:53 -0700
committerGitHub <noreply@github.com>2017-07-07 09:38:53 -0700
commit578220e62389af8fd7047da77b00171d45896c85 (patch)
tree930651956605a394478dbb3a5cd653e633d11d28 /lib
parent4c1b51c8fea9cec416c21dbd8b0c6222b5a1ce71 (diff)
parent58131d8ff1886352e964aafef58ffeb65c5d2cdd (diff)
Merge pull request #788 from tphoney/MODULES-5003
(MODULES-5003) file_line fix all broken lines
Diffstat (limited to 'lib')
-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