Skip to content

Commit

Permalink
Merge pull request #387 from hunner/remove_match_line
Browse files Browse the repository at this point in the history
Remove line match validation
  • Loading branch information
Morgan Haskel committed Dec 16, 2014
2 parents 0e84232 + c6c203f commit 80f0962
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 0 additions & 7 deletions lib/puppet/type/file_line.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,5 @@
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
4 changes: 2 additions & 2 deletions spec/unit/puppet/type/file_line_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
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 {
Expand Down

0 comments on commit 80f0962

Please sign in to comment.