Skip to content

Commit

Permalink
Merge branch '4.3.x'
Browse files Browse the repository at this point in the history
Conflicts:
	README.markdown
	lib/puppet/parser/functions/has_interface_with.rb
  • Loading branch information
Travis Fields committed Oct 24, 2014
2 parents 0c0f7e1 + cb6c7d8 commit f0b207c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
##2014-07-15 - Supported Release 4.3.2
###Summary

This release merely updates metadata.json so the module can be uninstalled and
upgraded via the puppet module command.

##2014-07-14 - Supported Release 4.3.1
### Summary
This supported release updates the metadata.json to work around upgrade behavior of the PMT.
Expand Down
1 change: 1 addition & 0 deletions lib/puppet/parser/functions/has_interface_with.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ module Puppet::Parser::Functions

result = false
interfaces.each do |iface|
iface.downcase!
factval = nil
begin
factval = lookupvar("#{kind}_#{iface}")
Expand Down
10 changes: 6 additions & 4 deletions lib/puppet/provider/file_line/ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def lines

def handle_create_with_match()
regex = resource[:match] ? Regexp.new(resource[:match]) : nil
match_count = lines.select { |l| regex.match(l) }.size
match_count = count_matches(regex)
if match_count > 1 && resource[:multiple].to_s != 'true'
raise Puppet::Error, "More than one line in file '#{resource[:path]}' matches pattern '#{resource[:match]}'"
end
Expand All @@ -51,9 +51,7 @@ def handle_create_with_match()

def handle_create_with_after
regex = Regexp.new(resource[:after])

count = lines.count {|l| l.match(regex)}

count = count_matches(regex)
case count
when 1 # find the line to put our line after
File.open(resource[:path], 'w') do |fh|
Expand All @@ -71,6 +69,10 @@ def handle_create_with_after
end
end

def count_matches(regex)
lines.select{|l| l.match(regex)}.size
end

##
# append the line to the file.
#
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppetlabs-stdlib",
"version": "4.3.1",
"version": "4.3.2",
"author": "puppetlabs",
"summary": "Puppet Module Standard Library",
"license": "Apache 2.0",
Expand Down

0 comments on commit f0b207c

Please sign in to comment.