cinder_type: Fix regex for properties to accept short value
This fixes the regex to validate the properties property so that value strings shorter than 3 characters are accepted. This also removes the heading spaces because these are not stripped but added to the keys, which likely results in an unexpected result. Change-Id: I8d703a48060abb61834ecec9c72bb6295eff2b81
This commit is contained in:
parent
c481593371
commit
0f500ef7da
@ -9,14 +9,14 @@ Puppet::Type.newtype(:cinder_type) do
|
||||
end
|
||||
|
||||
newproperty(:properties, :array_matching => :all) do
|
||||
desc 'The properties of the cinder type. Should be an array, all items should match pattern <key=value1[,value2 ...]>'
|
||||
desc 'The properties of the cinder type. Should be an array, all items should match pattern <key=value>'
|
||||
defaultto []
|
||||
def insync?(is)
|
||||
return false unless is.is_a? Array
|
||||
is.sort == should.sort
|
||||
end
|
||||
validate do |value|
|
||||
raise ArgumentError, "Properties doesn't match" unless value.match(/^\s*[^=\s]+=\S(([^=,])+((?<=\S),(?=\S))?)+([^\s=,])+$/)
|
||||
raise ArgumentError, "Properties doesn't match" unless value.match(/^[^=\s]+=[^=]+$/)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -14,6 +14,10 @@ describe 'basic cinder' do
|
||||
include openstack_integration::memcached
|
||||
include openstack_integration::keystone
|
||||
include openstack_integration::cinder
|
||||
|
||||
cinder_type { 'testvolumetype' :
|
||||
properties => ['k=v', 'key1=val1', 'key2=<is> True']
|
||||
}
|
||||
EOS
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user