From b29ee6f706bf7371f69b831f99727396ddb77cad Mon Sep 17 00:00:00 2001 From: Lukas Bezdicka Date: Thu, 26 Feb 2015 12:13:00 -0500 Subject: [PATCH] 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 --- lib/puppet/provider/neutron_network/neutron.rb | 10 +++++++--- spec/unit/provider/neutron_network/neutron_spec.rb | 9 ++++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/lib/puppet/provider/neutron_network/neutron.rb b/lib/puppet/provider/neutron_network/neutron.rb index 5587dfd55..e5a0c39bf 100644 --- a/lib/puppet/provider/neutron_network/neutron.rb +++ b/lib/puppet/provider/neutron_network/neutron.rb @@ -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 [ diff --git a/spec/unit/provider/neutron_network/neutron_spec.rb b/spec/unit/provider/neutron_network/neutron_spec.rb index 619a29c1c..974a7057b 100644 --- a/spec/unit/provider/neutron_network/neutron_spec.rb +++ b/spec/unit/provider/neutron_network/neutron_spec.rb @@ -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