summaryrefslogtreecommitdiff
path: root/lib/puppet/provider/file_line/ruby.rb
diff options
context:
space:
mode:
authorasif.shaikh <ripclaw_ffb@hotmail.com>2017-02-01 20:14:27 -0800
committerEric Putnam <putnam.eric@gmail.com>2017-07-18 14:24:43 -0700
commit703fa777e1daee97e2aea529064d773662ef1fe0 (patch)
tree74b26c4edd0858327d670ae39689e5b22c806ce4 /lib/puppet/provider/file_line/ruby.rb
parent596878a7bc1fd4a64da89c5c760accb3e8178ec1 (diff)
Add new file_line option append_on_no_match
Diffstat (limited to 'lib/puppet/provider/file_line/ruby.rb')
-rw-r--r--lib/puppet/provider/file_line/ruby.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/puppet/provider/file_line/ruby.rb b/lib/puppet/provider/file_line/ruby.rb
index 2f6c8ef..16f2709 100644
--- a/lib/puppet/provider/file_line/ruby.rb
+++ b/lib/puppet/provider/file_line/ruby.rb
@@ -12,7 +12,9 @@ Puppet::Type.type(:file_line).provide(:ruby) do
found = lines_count > 0
else
match_count = count_matches(new_match_regex)
- if resource[:replace].to_s == 'true'
+ if resource[:append_on_no_match].to_s == 'false'
+ found = true
+ elsif resource[:replace].to_s == 'true'
found = lines_count > 0 && lines_count == match_count
else
found = match_count > 0