diff options
author | Morgan Haskel <morgan@puppetlabs.com> | 2014-12-16 15:07:02 -0800 |
---|---|---|
committer | Morgan Haskel <morgan@puppetlabs.com> | 2014-12-16 15:07:02 -0800 |
commit | 80f09623b63cf6946b5913b629911e2c49b5d1dd (patch) | |
tree | 17c110fe8ec52b636a91a65acb4c13889295f62f | |
parent | 0e84232503d72cec0950f9e7fab11bc93cce116d (diff) | |
parent | c6c203fca8da81fea96659bfe9618bb31965b837 (diff) |
Merge pull request #387 from hunner/remove_match_line
Remove line match validation
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | lib/puppet/type/file_line.rb | 7 | ||||
-rwxr-xr-x | spec/unit/puppet/type/file_line_spec.rb | 4 |
3 files changed, 3 insertions, 9 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 8da04af..c66734e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ This release improves functionality of the member function and adds improved fut ####Bugfixes - Fix range() to work with numeric ranges with the future parser - Accurately express SLES support in metadata.json (was missing 10SP4 and 12) +- Don't require `line` to match the `match` parameter ##2014-11-10 - Supported Release 4.4.0 ###Summary diff --git a/lib/puppet/type/file_line.rb b/lib/puppet/type/file_line.rb index 9dbe43c..df263e6 100644 --- a/lib/puppet/type/file_line.rb +++ b/lib/puppet/type/file_line.rb @@ -71,12 +71,5 @@ Puppet::Type.newtype(:file_line) do unless self[:line] and self[:path] raise(Puppet::Error, "Both line and path are required attributes") end - - if (self[:match]) - unless Regexp.new(self[:match]).match(self[:line]) - raise(Puppet::Error, "When providing a 'match' parameter, the value must be a regex that matches against the value of your 'line' parameter") - end - end - end end diff --git a/spec/unit/puppet/type/file_line_spec.rb b/spec/unit/puppet/type/file_line_spec.rb index 9ef49ef..410d0bf 100755 --- a/spec/unit/puppet/type/file_line_spec.rb +++ b/spec/unit/puppet/type/file_line_spec.rb @@ -15,14 +15,14 @@ describe Puppet::Type.type(:file_line) do file_line[:match] = '^foo.*$' expect(file_line[:match]).to eq('^foo.*$') end - it 'should not accept a match regex that does not match the specified line' do + it 'should accept a match regex that does not match the specified line' do expect { Puppet::Type.type(:file_line).new( :name => 'foo', :path => '/my/path', :line => 'foo=bar', :match => '^bar=blah$' - )}.to raise_error(Puppet::Error, /the value must be a regex that matches/) + )}.not_to raise_error end it 'should accept a match regex that does match the specified line' do expect { |