Add ensure_absent_val behavior to Nuage neutron plugin type

This change adds ensure_absent_val behavior to Nuage neutron plugin
type. This property ensure absent when the value is either specified
as <SERVICE DEFAULT> or ensure_absent_val.

Added spec tests for ensure_absent_val

Change-Id: Ifb9df534463a820ac5b2c3b965e01bc61833f8de
This commit is contained in:
Lokesh Jain 2016-03-22 16:18:32 -04:00 committed by lokesh-jain
parent 7baa3858af
commit 1aabf09322
2 changed files with 23 additions and 0 deletions

View File

@ -16,6 +16,11 @@ Puppet::Type.newtype(:neutron_plugin_nuage) do
end
end
newparam(:ensure_absent_val) do
desc 'A value that is specified as the value property will behave as if ensure => absent was specified'
defaultto('<SERVICE DEFAULT>')
end
autorequire(:package) do
'neutron-plugin-nuage'
end

View File

@ -33,5 +33,23 @@ describe provider_class do
end
end
end
it 'should ensure absent when <SERVICE DEFAULT> is specified as a value' do
resource = Puppet::Type::Neutron_plugin_nuage.new(
{:name => 'somename/foo', :value => '<SERVICE DEFAULT>'}
)
provider = provider_class.new(resource)
provider.exists?
expect(resource[:ensure]).to eq :absent
end
it 'should ensure absent when value matches ensure_absent_val' do
resource = Puppet::Type::Neutron_plugin_nuage.new(
{:name => 'somename/foo', :value => 'foo', :ensure_absent_val => 'foo' }
)
provider = provider_class.new(resource)
provider.exists?
expect(resource[:ensure]).to eq :absent
end
end