Fix the subnet dhcp enable/disable param
neutron subnet-create/update use --enable-dhcp and --disable-dhcp to manage the dhcp of the subnet Change-Id: I4c19a770adba2c9eb601e4f389964d3da49cc93e
This commit is contained in:
parent
a929c1422d
commit
04c6ada8a6
@ -101,8 +101,10 @@ Puppet::Type.type(:neutron_subnet).provide(
|
||||
end
|
||||
end
|
||||
|
||||
if @resource[:enable_dhcp]
|
||||
opts << "--enable-dhcp=#{@resource[:enable_dhcp]}"
|
||||
if @resource[:enable_dhcp] == 'False'
|
||||
opts << "--disable-dhcp"
|
||||
else
|
||||
opts << "--enable-dhcp"
|
||||
end
|
||||
|
||||
if @resource[:allocation_pools]
|
||||
@ -175,7 +177,11 @@ Puppet::Type.type(:neutron_subnet).provide(
|
||||
end
|
||||
|
||||
def enable_dhcp=(value)
|
||||
auth_neutron('subnet-update', "--enable-dhcp=#{value}", name)
|
||||
if value == 'False'
|
||||
auth_neutron('subnet-update', "--disable-dhcp", name)
|
||||
else
|
||||
auth_neutron('subnet-update', "--enable-dhcp", name)
|
||||
end
|
||||
end
|
||||
|
||||
def dns_nameservers=(values)
|
||||
|
@ -51,7 +51,7 @@ describe provider_class do
|
||||
|
||||
it 'should call subnet-update to change enable_dhcp' do
|
||||
provider.expects(:auth_neutron).with('subnet-update',
|
||||
'--enable-dhcp=True',
|
||||
'--enable-dhcp',
|
||||
subnet_name)
|
||||
provider.enable_dhcp=('True')
|
||||
end
|
||||
@ -84,4 +84,24 @@ describe provider_class do
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when updating a subnet (reverse)' do
|
||||
let :subnet_attrs_mod do
|
||||
subnet_attrs.merge!({:enable_dhcp => 'True'})
|
||||
end
|
||||
let :resource do
|
||||
Puppet::Type::Neutron_subnet.new(subnet_attrs_mod)
|
||||
end
|
||||
|
||||
let :provider do
|
||||
provider_class.new(resource)
|
||||
end
|
||||
|
||||
|
||||
it 'should call subnet-update to change enable_dhcp' do
|
||||
provider.expects(:auth_neutron).with('subnet-update',
|
||||
'--disable-dhcp',
|
||||
subnet_name)
|
||||
provider.enable_dhcp=('False')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user