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
This commit is contained in:
parent
4fce711b3e
commit
b7a15fc68c
@ -22,7 +22,7 @@ Puppet::Type.newtype(:vs_bridge) do
|
||||
if !value.is_a?(String)
|
||||
raise ArgumentError, "Invalid external_ids #{value}. Requires a String, not a #{value.class}"
|
||||
end
|
||||
if value !~ /^(?>[a-zA-Z]\w*=\w*){1}(?>[,][a-zA-Z]\w*=\w*)*$/
|
||||
if value !~ /^(?>[a-zA-Z]\S*=\S*){1}(?>[,][a-zA-Z]\S*=\S*)*$/
|
||||
raise ArgumentError, "Invalid external_ids #{value}. Must a list of key1=value2,key2=value2"
|
||||
end
|
||||
end
|
||||
|
11
spec/unit/puppet/lib/type/vs_bridge_spec.rb
Normal file
11
spec/unit/puppet/lib/type/vs_bridge_spec.rb
Normal file
@ -0,0 +1,11 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe Puppet::Type.type(:vs_bridge) do
|
||||
|
||||
it "should support present as a value for ensure" do
|
||||
expect do
|
||||
described_class.new(:name => 'foo', :ensure => :present, :external_ids => 'foo=br-ex,blah-id=bar)')
|
||||
end.to_not raise_error
|
||||
end
|
||||
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user