Merge "cinder_qos: Fix parsing of associations field"
This commit is contained in:
commit
9458f6c595
@ -27,13 +27,11 @@ Puppet::Type.type(:cinder_qos).provide(
|
|||||||
@property_hash[:properties] = resource[:properties]
|
@property_hash[:properties] = resource[:properties]
|
||||||
@property_hash[:consumer] = resource[:consumer]
|
@property_hash[:consumer] = resource[:consumer]
|
||||||
@property_hash[:name] = name
|
@property_hash[:name] = name
|
||||||
unless resource[:associations].empty?
|
|
||||||
resource[:associations].each do |item|
|
resource[:associations].each do |item|
|
||||||
self.class.request('volume qos', 'associate', [name, item])
|
self.class.request('volume qos', 'associate', [name, item])
|
||||||
end
|
end
|
||||||
@property_hash[:associations] = resource[:associations]
|
@property_hash[:associations] = resource[:associations]
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
self.class.request('volume qos', 'delete', name)
|
self.class.request('volume qos', 'delete', name)
|
||||||
@ -94,6 +92,6 @@ Puppet::Type.type(:cinder_qos).provide(
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.string2array(input)
|
def self.string2array(input)
|
||||||
return input.delete("'").split(/,\s/)
|
return input[1..-2].delete("'").split(/,\s/)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -58,8 +58,8 @@ properties="{\'key1\': \'value1\', \'key2\': \'value2\'}"
|
|||||||
expect(provider_class).to receive(:openstack)
|
expect(provider_class).to receive(:openstack)
|
||||||
.with('volume qos', 'list', '--quiet', '--format', 'csv', [])
|
.with('volume qos', 'list', '--quiet', '--format', 'csv', [])
|
||||||
.and_return('"ID","Name","Consumer","Associations","Properties"
|
.and_return('"ID","Name","Consumer","Associations","Properties"
|
||||||
"28b632e8-6694-4bba-bf68-67b19f619019","qos-1","front-end","my_type1, my_type2","{\'read_iops\': \'value1\', \'write_iops\':\'value2\'}"
|
"28b632e8-6694-4bba-bf68-67b19f619019","qos-1","front-end","[\'my_type1\', \'my_type2\']","{\'read_iops\': \'value1\', \'write_iops\':\'value2\'}"
|
||||||
"4f992f69-14ec-4132-9313-55cc06a6f1f6","qos-2","both","","{}"
|
"4f992f69-14ec-4132-9313-55cc06a6f1f6","qos-2","both","[]","{}"
|
||||||
')
|
')
|
||||||
instances = provider_class.instances
|
instances = provider_class.instances
|
||||||
expect(instances.count).to eq(2)
|
expect(instances.count).to eq(2)
|
||||||
@ -75,9 +75,9 @@ properties="{\'key1\': \'value1\', \'key2\': \'value2\'}"
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe '#string2array' do
|
describe '#string2array' do
|
||||||
it 'should return an array with key-value' do
|
it 'should return an array' do
|
||||||
s = "key='value', key2='value2'"
|
s = "['foo', 'bar']"
|
||||||
expect(provider_class.string2array(s)).to eq(['key=value', 'key2=value2'])
|
expect(provider_class.string2array(s)).to eq(['foo', 'bar'])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user