Fix neutron_network for --router:external setting

Neutron can't be called with --router:external=True as that
will cause "ignored explicit argument u'True'" error.

Change-Id: I49a033fd2821100283e217225896fc93a927edd2
This commit is contained in:
Lukas Bezdicka 2015-02-26 12:13:00 -05:00 committed by Gael Chamoulaud
parent 2b530fca23
commit b29ee6f706
2 changed files with 15 additions and 4 deletions

View File

@ -80,8 +80,8 @@ Puppet::Type.type(:neutron_network).provide(
"--provider:segmentation_id=#{@resource[:provider_segmentation_id]}"
end
if @resource[:router_external]
network_opts << "--router:external=#{@resource[:router_external]}"
if @resource[:router_external] == 'True'
network_opts << '--router:external'
end
results = auth_neutron('net-create', '--format=shell',
@ -120,7 +120,11 @@ Puppet::Type.type(:neutron_network).provide(
end
def router_external=(value)
auth_neutron('net-update', "--router:external=#{value}", name)
if value == 'False'
auth_neutron('net-update', "--router:external=#{value}", name)
else
auth_neutron('net-update', "--router:external", name)
end
end
[

View File

@ -46,7 +46,14 @@ describe provider_class do
it 'should call net-update to change router_external' do
provider.expects(:auth_neutron).with('net-update',
'--router:external=True',
'--router:external=False',
net_name)
provider.router_external=('False')
end
it 'should call net-update to change router_external' do
provider.expects(:auth_neutron).with('net-update',
'--router:external',
net_name)
provider.router_external=('True')
end