Skip to content

Commit b7a15fc

Browse files
committed
Allow non-word characters in vs_bridge external_ids
Currently, the type enforces a regex for vs_bridge external id values that is way to strict. Essentially that entries are \w*=\w*. Bridge external ids commonly include non-word characters , like '-' (ie: br-ex). This patch updates the parameter checking to allow any non-whitespace characters. Change-Id: I26d47b9744e6e294b0b1bc09cd6268f5587f8bd8
1 parent 4fce711 commit b7a15fc

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

lib/puppet/type/vs_bridge.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
if !value.is_a?(String)
2323
raise ArgumentError, "Invalid external_ids #{value}. Requires a String, not a #{value.class}"
2424
end
25-
if value !~ /^(?>[a-zA-Z]\w*=\w*){1}(?>[,][a-zA-Z]\w*=\w*)*$/
25+
if value !~ /^(?>[a-zA-Z]\S*=\S*){1}(?>[,][a-zA-Z]\S*=\S*)*$/
2626
raise ArgumentError, "Invalid external_ids #{value}. Must a list of key1=value2,key2=value2"
2727
end
2828
end
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
require 'spec_helper'
2+
3+
describe Puppet::Type.type(:vs_bridge) do
4+
5+
it "should support present as a value for ensure" do
6+
expect do
7+
described_class.new(:name => 'foo', :ensure => :present, :external_ids => 'foo=br-ex,blah-id=bar)')
8+
end.to_not raise_error
9+
end
10+
11+
end

0 commit comments

Comments
 (0)