summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/provider/file_line/ruby.rb4
-rw-r--r--lib/puppet/type/file_line.rb4
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/puppet/provider/file_line/ruby.rb b/lib/puppet/provider/file_line/ruby.rb
index ea1d44d..d4cdfec 100644
--- a/lib/puppet/provider/file_line/ruby.rb
+++ b/lib/puppet/provider/file_line/ruby.rb
@@ -1,6 +1,6 @@
Puppet::Type.type(:file_line).provide(:ruby) do
def exists?
- if !resource[:replace] and count_matches(match_regex) > 0
+ if resource[:replace].to_s != 'true' and count_matches(match_regex) > 0
true
else
lines.find do |line|
@@ -10,7 +10,7 @@ Puppet::Type.type(:file_line).provide(:ruby) do
end
def create
- unless !resource[:replace] and count_matches(match_regex) > 0
+ unless resource[:replace].to_s != 'true' and count_matches(match_regex) > 0
if resource[:match]
handle_create_with_match
elsif resource[:after]
diff --git a/lib/puppet/type/file_line.rb b/lib/puppet/type/file_line.rb
index 190105c..4a96ba7 100644
--- a/lib/puppet/type/file_line.rb
+++ b/lib/puppet/type/file_line.rb
@@ -1,4 +1,3 @@
-require 'puppet/parameter/boolean'
Puppet::Type.newtype(:file_line) do
desc <<-EOT
@@ -79,8 +78,9 @@ Puppet::Type.newtype(:file_line) do
end
end
- newparam(:replace, :boolean => true, :parent => Puppet::Parameter::Boolean) do
+ newparam(:replace) do
desc 'If true, replace line that matches. If false, do not write line if a match is found'
+ newvalues(true, false)
defaultto true
end