Merge "provider/neutron.rb: fix list_router_ports"
This commit is contained in:
commit
fd0d670c58
@ -210,8 +210,10 @@ correctly configured.")
|
|||||||
|
|
||||||
self.find_and_parse_json(cmd_output).each do |port|
|
self.find_and_parse_json(cmd_output).each do |port|
|
||||||
if port['fixed_ips']
|
if port['fixed_ips']
|
||||||
fixed_ips = JSON.parse(port['fixed_ips'])
|
if !port['fixed_ips'].empty?
|
||||||
port['subnet_id'] = fixed_ips['subnet_id']
|
fixed_ips = JSON.parse(port['fixed_ips'])
|
||||||
|
port['subnet_id'] = fixed_ips['subnet_id']
|
||||||
|
end
|
||||||
port.delete('fixed_ips')
|
port.delete('fixed_ips')
|
||||||
end
|
end
|
||||||
results << port
|
results << port
|
||||||
|
@ -243,6 +243,29 @@ describe Puppet::Provider::Neutron do
|
|||||||
expect(result).to eql(expected)
|
expect(result).to eql(expected)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
it 'should handle empty fixed_ips field' do
|
||||||
|
output = '''
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"id": "1345e576-a21f-4c2e-b24a-b245639852ab",
|
||||||
|
"name": "",
|
||||||
|
"mac_address": "fa:16:3e:e3:e6:38",
|
||||||
|
"fixed_ips": ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
'''
|
||||||
|
expected =
|
||||||
|
[{ "name"=>"",
|
||||||
|
"id"=>"1345e576-a21f-4c2e-b24a-b245639852ab",
|
||||||
|
"mac_address"=>"fa:16:3e:e3:e6:38"}]
|
||||||
|
klass.expects(:auth_neutron).
|
||||||
|
with('router-port-list', '--format=json', router).
|
||||||
|
returns(output)
|
||||||
|
result = klass.list_router_ports(router)
|
||||||
|
expect(result).to eql(expected)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'when parsing creation output' do
|
describe 'when parsing creation output' do
|
||||||
|
Loading…
Reference in New Issue
Block a user