diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/provider/file_line/ruby.rb | 6 | ||||
-rw-r--r-- | lib/puppet/type/file_line.rb | 3 |
2 files changed, 7 insertions, 2 deletions
diff --git a/lib/puppet/provider/file_line/ruby.rb b/lib/puppet/provider/file_line/ruby.rb index aab6fe2..beeb430 100644 --- a/lib/puppet/provider/file_line/ruby.rb +++ b/lib/puppet/provider/file_line/ruby.rb @@ -4,7 +4,11 @@ Puppet::Type.type(:file_line).provide(:ruby) do true else lines.find do |line| - line.chomp == resource[:line].chomp + if resource[:ensure].to_s == 'absent' and resource[:match_for_absence].to_s == 'true' + line.chomp =~ Regexp.new(resource[:match]) + else + line.chomp == resource[:line].chomp + end end end end diff --git a/lib/puppet/type/file_line.rb b/lib/puppet/type/file_line.rb index 6f5c188..7b7d44e 100644 --- a/lib/puppet/type/file_line.rb +++ b/lib/puppet/type/file_line.rb @@ -71,7 +71,8 @@ Puppet::Type.newtype(:file_line) do newparam(:match_for_absence) do desc 'An optional value to determine if match should be applied when ensure => absent.' + ' If set to true and match is set, the line that matches match will be deleted.' + - ' If set to false (the default), match is ignored when ensure => absent.' + ' If set to false (the default), match is ignored when ensure => absent.' + + ' When `ensure => present`, match_for_absence is ignored.' newvalues(true, false) defaultto false end |