Fix parsing of image properties

when more then one pair of key/value's are given
then this code shows wrong behavior:

vm_mode=exe,cinder_img_volume_type=vstorage
it makes this:
vm_mode=''exe',cinder_img_volume_type=vstorage'

Reason is the first conversion being to broad, and 2nd match matches
the whole string.

Change-Id: I5bcf23374b57197680b87b554392ee172bf90571
This commit is contained in:
Evgeny Antyshev 2017-06-13 15:30:11 +00:00
parent 08cbeacf55
commit dea0beff1a
1 changed files with 1 additions and 3 deletions

View File

@ -89,9 +89,7 @@ Puppet::Type.newtype(:glance_image) do
munge do |value|
return value if value.is_a? Hash
# wrap property value in commas
value.gsub!(/=(\w+)/, '=\'\1\'')
Hash[value.scan(/(\S+)='([^']*)'/)]
Hash[value.scan(/([^,=]+)=([^,]*)/)]
end
validate do |value|