summaryrefslogtreecommitdiff
path: root/lib/puppet
diff options
context:
space:
mode:
authorHunter Haugen <hunter@puppetlabs.com>2016-04-07 15:10:07 -0700
committerHunter Haugen <hunter@puppetlabs.com>2016-04-07 15:10:07 -0700
commitbe1ff3f09e35d5e6aa1d2112311ba9e5258b76f1 (patch)
tree5e9fb3318d444091b48638c3bc8139bfd9e90e37 /lib/puppet
parent6248d241bc839b0717b6e881858d1e38938f3aa3 (diff)
parent7e408ca7970fd172822db02227935798f9ff282f (diff)
Merge pull request #585 from jearls/MODULES-2370-update-validate-to-not-require-line-when-matching-for-absence
[MODULES-2370] file_line.rb: Fix `line` attribute validation
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/type/file_line.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/puppet/type/file_line.rb b/lib/puppet/type/file_line.rb
index 77d3be2..f2c6937 100644
--- a/lib/puppet/type/file_line.rb
+++ b/lib/puppet/type/file_line.rb
@@ -111,8 +111,13 @@ Puppet::Type.newtype(:file_line) do
end
validate do
- unless self[:line] and self[:path]
- raise(Puppet::Error, "Both line and path are required attributes")
+ unless self[:line]
+ unless (self[:ensure].to_s == 'absent') and (self[:match_for_absence].to_s == 'true') and self[:match]
+ raise(Puppet::Error, "line is a required attribute")
+ end
+ end
+ unless self[:path]
+ raise(Puppet::Error, "path is a required attribute")
end
end
end