Reflect provider change in puppet-openstacklib

With the creation of the new openstack_config provider, some processing
that was done in neutron_config has been centralized in
openstack_config.

The same logic applies for all the neutron resources that edit a
ini-like configuration file.

Impacted methods are :

  * section
  * setting
  * separator

Also, this commit adds the fact that, when passing a specific string
(ensure_absent_val) the provider will behave as if ensure => absent was
specified. '<SERVICE DEFAULT>' is the default value for
ensure_absent_val.

The use case is the following :

neutron_config { 'DEFAULT/foo' : value => 'bar' } # will work as usual

neutron_config { 'DEFAULT/foo' : value => '<SERVICE DEFAULT>' } # will mean absent

That means that all the current :

if $myvar {
  neutron_config { 'DEFAULT/foo' : value => $myvar }
} else {
  neutron_config { 'DEFAULT/foo' : ensure => absent }
}

can be removed in favor of :

neutron_config { 'DEFAULT/foo' : value => $myvar }

If for any reason '<SERVICE DEFAULT>' turns out to be a valid value for
a specific parameter. One could by pass that doing the following :

neutron_config { 'DEFAULT/foo' : value => '<SERVICE DEFAULT>',
ensure_absent_val => 'foo' }

Change-Id: I3f972ecbde3719fe71a82a64f894d41f6ea7e842
Depends-On: I0eeebde3aac2662cc7e69bfad7f8d2481463a218
This commit is contained in:
Yanis Guenane 2015-08-06 13:06:07 +02:00
parent 4445f3aaab
commit e956eba829
67 changed files with 1862 additions and 295 deletions

View File

@ -94,6 +94,36 @@ Implementation
neutron is a combination of Puppet manifest and ruby code to deliver configuration and extra functionality through *types* and *providers*.
### Types
#### neutron_config
The `neutron_config` provider is a children of the ini_setting provider. It allows one to write an entry in the `/etc/neutron/neutron.conf` file.
```puppet
neutron_config { 'DEFAULT/verbose' :
value => true,
}
```
This will write `verbose=true` in the `[DEFAULT]` section.
##### name
Section/setting name to manage from `neutron.conf`
##### value
The value of the setting to be defined.
##### secret
Whether to hide the value from Puppet logs. Defaults to `false`.
##### ensure_absent_val
If value is equal to ensure_absent_val then the resource will behave as if `ensure => absent` was specified. Defaults to `<SERVICE DEFAULT>`
Limitations
-----------

View File

@ -1,20 +1,8 @@
Puppet::Type.type(:neutron_agent_linuxbridge).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
:parent => Puppet::Type.type(:openstack_config).provider(:ini_setting)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def file_path
if Facter['operatingsystem'].value == 'Ubuntu'
'/etc/neutron/plugins/ml2/ml2_conf.ini'

View File

@ -1,20 +1,8 @@
Puppet::Type.type(:neutron_agent_ovs).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
:parent => Puppet::Type.type(:openstack_config).provider(:ini_setting)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def file_path
if Facter['operatingsystem'].value == 'Ubuntu'
'/etc/neutron/plugins/ml2/ml2_conf.ini'

View File

@ -1,20 +1,8 @@
Puppet::Type.type(:neutron_api_config).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
:parent => Puppet::Type.type(:openstack_config).provider(:ini_setting)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def file_path
'/etc/neutron/api-paste.ini'
end

View File

@ -1,20 +1,8 @@
Puppet::Type.type(:neutron_config).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
:parent => Puppet::Type.type(:openstack_config).provider(:ini_setting)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def file_path
'/etc/neutron/neutron.conf'
end

View File

@ -1,20 +1,8 @@
Puppet::Type.type(:neutron_dhcp_agent_config).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
:parent => Puppet::Type.type(:openstack_config).provider(:ini_setting)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def file_path
'/etc/neutron/dhcp_agent.ini'
end

View File

@ -1,20 +1,8 @@
Puppet::Type.type(:neutron_fwaas_service_config).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
:parent => Puppet::Type.type(:openstack_config).provider(:ini_setting)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def file_path
'/etc/neutron/fwaas_driver.ini'
end

View File

@ -1,20 +1,8 @@
Puppet::Type.type(:neutron_l3_agent_config).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
:parent => Puppet::Type.type(:openstack_config).provider(:ini_setting)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def file_path
'/etc/neutron/l3_agent.ini'
end

View File

@ -1,20 +1,8 @@
Puppet::Type.type(:neutron_lbaas_agent_config).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
:parent => Puppet::Type.type(:openstack_config).provider(:ini_setting)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def file_path
'/etc/neutron/lbaas_agent.ini'
end

View File

@ -1,20 +1,8 @@
Puppet::Type.type(:neutron_metadata_agent_config).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
:parent => Puppet::Type.type(:openstack_config).provider(:ini_setting)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def file_path
'/etc/neutron/metadata_agent.ini'
end

View File

@ -1,20 +1,8 @@
Puppet::Type.type(:neutron_metering_agent_config).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
:parent => Puppet::Type.type(:openstack_config).provider(:ini_setting)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def file_path
'/etc/neutron/metering_agent.ini'
end

View File

@ -1,20 +1,8 @@
Puppet::Type.type(:neutron_plugin_cisco).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
:parent => Puppet::Type.type(:openstack_config).provider(:ini_setting)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def file_path
'/etc/neutron/plugins/cisco/cisco_plugins.ini'
end

View File

@ -1,20 +1,8 @@
Puppet::Type.type(:neutron_plugin_cisco_credentials).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
:parent => Puppet::Type.type(:openstack_config).provider(:ini_setting)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def file_path
'/etc/neutron/plugins/cisco/credentials.ini'
end

View File

@ -1,20 +1,8 @@
Puppet::Type.type(:neutron_plugin_cisco_db_conn).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
:parent => Puppet::Type.type(:openstack_config).provider(:ini_setting)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def file_path
'/etc/neutron/plugins/cisco/db_conn.ini'
end

View File

@ -1,20 +1,8 @@
Puppet::Type.type(:neutron_plugin_cisco_l2network).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
:parent => Puppet::Type.type(:openstack_config).provider(:ini_setting)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def file_path
'/etc/neutron/plugins/cisco/l2network_plugin.ini'
end

View File

@ -1,20 +1,8 @@
Puppet::Type.type(:neutron_plugin_linuxbridge).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
:parent => Puppet::Type.type(:openstack_config).provider(:ini_setting)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def file_path
'/etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini'
end

View File

@ -1,20 +1,8 @@
Puppet::Type.type(:neutron_plugin_midonet).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
:parent => Puppet::Type.type(:openstack_config).provider(:ini_setting)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def file_path
'/etc/neutron/plugins/midonet/midonet.ini'
end

View File

@ -1,20 +1,8 @@
Puppet::Type.type(:neutron_plugin_ml2).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
:parent => Puppet::Type.type(:openstack_config).provider(:ini_setting)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def file_path
'/etc/neutron/plugins/ml2/ml2_conf.ini'
end

View File

@ -1,20 +1,8 @@
Puppet::Type.type(:neutron_plugin_nvp).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
:parent => Puppet::Type.type(:openstack_config).provider(:ini_setting)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def file_path
'/etc/neutron/plugins/nicira/nvp.ini'
end

View File

@ -1,20 +1,8 @@
Puppet::Type.type(:neutron_plugin_opencontrail).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
:parent => Puppet::Type.type(:openstack_config).provider(:ini_setting)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def file_path
'/etc/neutron/plugins/opencontrail/ContrailPlugin.ini'
end

View File

@ -1,20 +1,8 @@
Puppet::Type.type(:neutron_plugin_plumgrid).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
:parent => Puppet::Type.type(:openstack_config).provider(:ini_setting)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def file_path
'/etc/neutron/plugins/plumgrid/plumgrid.ini'
end

View File

@ -1,20 +1,8 @@
Puppet::Type.type(:neutron_plumlib_plumgrid).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
:parent => Puppet::Type.type(:openstack_config).provider(:ini_setting)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def file_path
'/etc/neutron/plugins/plumgrid/plumlib.ini'
end

View File

@ -1,20 +1,8 @@
Puppet::Type.type(:neutron_vpnaas_agent_config).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
:parent => Puppet::Type.type(:openstack_config).provider(:ini_setting)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def file_path
'/etc/neutron/vpn_agent.ini'
end

View File

@ -16,6 +16,11 @@ Puppet::Type.newtype(:neutron_agent_linuxbridge) 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-linuxbridge-agent'
end

View File

@ -16,6 +16,11 @@ Puppet::Type.newtype(:neutron_agent_ovs) 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-ovs-agent'
end

View File

@ -40,4 +40,9 @@ Puppet::Type.newtype(:neutron_api_config) do
defaultto false
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
end

View File

@ -14,6 +14,7 @@ Puppet::Type.newtype(:neutron_config) do
value.capitalize! if value =~ /^(true|false)$/i
value
end
newvalues(/^[\S ]*$/)
def is_to_s( currentvalue )
if resource.secret?
@ -40,6 +41,11 @@ Puppet::Type.newtype(:neutron_config) do
defaultto false
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
def create
provider.create
end

View File

@ -16,6 +16,11 @@ Puppet::Type.newtype(:neutron_dhcp_agent_config) 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'
end

View File

@ -16,6 +16,11 @@ Puppet::Type.newtype(:neutron_fwaas_service_config) 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-fwaas'
end

View File

@ -16,6 +16,11 @@ Puppet::Type.newtype(:neutron_l3_agent_config) 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'
end

View File

@ -16,6 +16,11 @@ Puppet::Type.newtype(:neutron_lbaas_agent_config) 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-lbaas-agent'
end

View File

@ -40,6 +40,11 @@ Puppet::Type.newtype(:neutron_metadata_agent_config) do
defaultto false
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'
end

View File

@ -16,6 +16,11 @@ Puppet::Type.newtype(:neutron_metering_agent_config) 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', 'neutron-metering-agent']
end

View File

@ -40,6 +40,11 @@ Puppet::Type.newtype(:neutron_plugin_cisco) do
defaultto false
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(:file) do
['/etc/neutron/plugins/cisco']
end

View File

@ -41,6 +41,11 @@ Puppet::Type.newtype(:neutron_plugin_cisco_credentials) do
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(:file) do
['/etc/neutron/plugins/cisco']
end

View File

@ -16,6 +16,11 @@ Puppet::Type.newtype(:neutron_plugin_cisco_db_conn) 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(:file) do
['/etc/neutron/plugins/cisco']
end

View File

@ -16,6 +16,11 @@ Puppet::Type.newtype(:neutron_plugin_cisco_l2network) 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(:file) do
['/etc/neutron/plugins/cisco']
end

View File

@ -15,4 +15,10 @@ Puppet::Type.newtype(:neutron_plugin_linuxbridge) do
value
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
end

View File

@ -7,10 +7,6 @@ Puppet::Type.newtype(:neutron_plugin_midonet) do
newvalues(/\S+\/\S+/)
end
autorequire(:file) do
['/etc/neutron/plugins/midonet']
end
autorequire(:package) do ['neutron'] end
newproperty(:value) do
@ -46,9 +42,17 @@ Puppet::Type.newtype(:neutron_plugin_midonet) do
defaultto false
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(:file) do
['/etc/neutron/plugins/midonet']
end
autorequire(:package) do
'python-neutron-plugin-midonet'
end
end

View File

@ -16,6 +16,11 @@ Puppet::Type.newtype(:neutron_plugin_ml2) 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', 'neutron-plugin-ml2']
end

View File

@ -40,6 +40,11 @@ Puppet::Type.newtype(:neutron_plugin_nvp) do
defaultto false
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-nvp'
end

View File

@ -40,6 +40,11 @@ Puppet::Type.newtype(:neutron_plugin_opencontrail) do
defaultto false
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(:file) do
['/etc/neutron/plugins/opencontrail']
end

View File

@ -40,6 +40,11 @@ Puppet::Type.newtype(:neutron_plugin_plumgrid) do
defaultto false
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(:file) do
['/etc/neutron/plugins/plumgrid']
end

View File

@ -40,6 +40,11 @@ Puppet::Type.newtype(:neutron_plumlib_plumgrid) do
defaultto false
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(:file) do
['/etc/neutron/plugins/plumgrid']
end

View File

@ -16,6 +16,11 @@ Puppet::Type.newtype(:neutron_vpnaas_agent_config) 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', 'neutron-vpnaas-agent']
end

View File

@ -0,0 +1,506 @@
require 'spec_helper_acceptance'
describe 'basic neutron_config resource' do
context 'default parameters' do
it 'should work with no errors' do
pp= <<-EOS
Exec { logoutput => 'on_failure' }
File <||> -> Neutron_config <||>
File <||> -> Neutron_api_config <||>
File <||> -> Neutron_dhcp_agent_config <||>
File <||> -> Neutron_fwaas_service_config <||>
File <||> -> Neutron_l3_agent_config <||>
File <||> -> Neutron_lbaas_agent_config <||>
File <||> -> Neutron_metadata_agent_config <||>
File <||> -> Neutron_metering_agent_config <||>
File <||> -> Neutron_plugin_cisco <||>
File <||> -> Neutron_plugin_cisco_credentials <||>
File <||> -> Neutron_plugin_cisco_db_conn <||>
File <||> -> Neutron_plugin_cisco_l2network <||>
File <||> -> Neutron_plugin_linuxbridge <||>
File <||> -> Neutron_plugin_ml2 <||>
File <||> -> Neutron_plugin_nvp <||>
File <||> -> Neutron_vpnaas_agent_config <||>
File <||> -> Neutron_plugin_midonet <||>
File <||> -> Neutron_plugin_opencontrail <||>
File <||> -> Neutron_agent_linuxbridge <||>
File <||> -> Neutron_agent_ovs <||>
File <||> -> Neutron_plugin_plumgrid <||>
File <||> -> Neutron_plumlib_plumgrid <||>
$neutron_directories = ['/etc/neutron',
'/etc/neutron/plugins',
'/etc/neutron/plugins/cisco',
'/etc/neutron/plugins/linuxbridge',
'/etc/neutron/plugins/ml2',
'/etc/neutron/plugins/nicira',
'/etc/neutron/plugins/midonet',
'/etc/neutron/plugins/opencontrail',
'/etc/neutron/plugins/plumgrid']
$neutron_files = [ '/etc/neutron/api-paste.ini',
'/etc/neutron/neutron.conf',
'/etc/neutron/dhcp_agent.ini',
'/etc/neutron/fwaas_driver.ini',
'/etc/neutron/l3_agent.ini',
'/etc/neutron/lbaas_agent.ini',
'/etc/neutron/metadata_agent.ini',
'/etc/neutron/metering_agent.ini',
'/etc/neutron/plugins/cisco/cisco_plugins.ini',
'/etc/neutron/plugins/cisco/credentials.ini',
'/etc/neutron/plugins/cisco/db_conn.ini',
'/etc/neutron/plugins/cisco/l2network_plugin.ini',
'/etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini',
'/etc/neutron/plugins/ml2/ml2_conf.ini',
'/etc/neutron/plugins/nicira/nvp.ini',
'/etc/neutron/vpn_agent.ini',
'/etc/neutron/plugins/midonet/midonet.ini',
'/etc/neutron/plugins/opencontrail/ContrailPlugin.ini',
'/etc/neutron/plugins/plumgrid/plumgrid.ini']
file { $neutron_directories :
ensure => directory,
}
file { $neutron_files :
ensure => file,
}
neutron_api_config { 'DEFAULT/thisshouldexist' :
value => 'foo',
}
neutron_api_config { 'DEFAULT/thisshouldnotexist' :
value => '<SERVICE DEFAULT>',
}
neutron_api_config { 'DEFAULT/thisshouldexist2' :
value => '<SERVICE DEFAULT>',
ensure_absent_val => 'toto',
}
neutron_api_config { 'DEFAULT/thisshouldnotexist2' :
value => 'toto',
ensure_absent_val => 'toto',
}
neutron_config { 'DEFAULT/thisshouldexist' :
value => 'foo',
}
neutron_config { 'DEFAULT/thisshouldnotexist' :
value => '<SERVICE DEFAULT>',
}
neutron_config { 'DEFAULT/thisshouldexist2' :
value => '<SERVICE DEFAULT>',
ensure_absent_val => 'toto',
}
neutron_config { 'DEFAULT/thisshouldnotexist2' :
value => 'toto',
ensure_absent_val => 'toto',
}
neutron_dhcp_agent_config { 'DEFAULT/thisshouldexist' :
value => 'foo',
}
neutron_dhcp_agent_config { 'DEFAULT/thisshouldnotexist' :
value => '<SERVICE DEFAULT>',
}
neutron_dhcp_agent_config { 'DEFAULT/thisshouldexist2' :
value => '<SERVICE DEFAULT>',
ensure_absent_val => 'toto',
}
neutron_dhcp_agent_config { 'DEFAULT/thisshouldnotexist2' :
value => 'toto',
ensure_absent_val => 'toto',
}
neutron_fwaas_service_config { 'DEFAULT/thisshouldexist' :
value => 'foo',
}
neutron_fwaas_service_config { 'DEFAULT/thisshouldnotexist' :
value => '<SERVICE DEFAULT>',
}
neutron_fwaas_service_config { 'DEFAULT/thisshouldexist2' :
value => '<SERVICE DEFAULT>',
ensure_absent_val => 'toto',
}
neutron_fwaas_service_config { 'DEFAULT/thisshouldnotexist2' :
value => 'toto',
ensure_absent_val => 'toto',
}
neutron_l3_agent_config { 'DEFAULT/thisshouldexist' :
value => 'foo',
}
neutron_l3_agent_config { 'DEFAULT/thisshouldnotexist' :
value => '<SERVICE DEFAULT>',
}
neutron_l3_agent_config { 'DEFAULT/thisshouldexist2' :
value => '<SERVICE DEFAULT>',
ensure_absent_val => 'toto',
}
neutron_l3_agent_config { 'DEFAULT/thisshouldnotexist2' :
value => 'toto',
ensure_absent_val => 'toto',
}
neutron_lbaas_agent_config { 'DEFAULT/thisshouldexist' :
value => 'foo',
}
neutron_lbaas_agent_config { 'DEFAULT/thisshouldnotexist' :
value => '<SERVICE DEFAULT>',
}
neutron_lbaas_agent_config { 'DEFAULT/thisshouldexist2' :
value => '<SERVICE DEFAULT>',
ensure_absent_val => 'toto',
}
neutron_lbaas_agent_config { 'DEFAULT/thisshouldnotexist2' :
value => 'toto',
ensure_absent_val => 'toto',
}
neutron_metadata_agent_config { 'DEFAULT/thisshouldexist' :
value => 'foo',
}
neutron_metadata_agent_config { 'DEFAULT/thisshouldnotexist' :
value => '<SERVICE DEFAULT>',
}
neutron_metadata_agent_config { 'DEFAULT/thisshouldexist2' :
value => '<SERVICE DEFAULT>',
ensure_absent_val => 'toto',
}
neutron_metadata_agent_config { 'DEFAULT/thisshouldnotexist2' :
value => 'toto',
ensure_absent_val => 'toto',
}
neutron_metering_agent_config { 'DEFAULT/thisshouldexist' :
value => 'foo',
}
neutron_metering_agent_config { 'DEFAULT/thisshouldnotexist' :
value => '<SERVICE DEFAULT>',
}
neutron_metering_agent_config { 'DEFAULT/thisshouldexist2' :
value => '<SERVICE DEFAULT>',
ensure_absent_val => 'toto',
}
neutron_metering_agent_config { 'DEFAULT/thisshouldnotexist2' :
value => 'toto',
ensure_absent_val => 'toto',
}
neutron_plugin_cisco { 'DEFAULT/thisshouldexist' :
value => 'foo',
}
neutron_plugin_cisco { 'DEFAULT/thisshouldnotexist' :
value => '<SERVICE DEFAULT>',
}
neutron_plugin_cisco { 'DEFAULT/thisshouldexist2' :
value => '<SERVICE DEFAULT>',
ensure_absent_val => 'toto',
}
neutron_plugin_cisco { 'DEFAULT/thisshouldnotexist2' :
value => 'toto',
ensure_absent_val => 'toto',
}
neutron_plugin_cisco_credentials { 'DEFAULT/thisshouldexist' :
value => 'foo',
}
neutron_plugin_cisco_credentials { 'DEFAULT/thisshouldnotexist' :
value => '<SERVICE DEFAULT>',
}
neutron_plugin_cisco_credentials { 'DEFAULT/thisshouldexist2' :
value => '<SERVICE DEFAULT>',
ensure_absent_val => 'toto',
}
neutron_plugin_cisco_credentials { 'DEFAULT/thisshouldnotexist2' :
value => 'toto',
ensure_absent_val => 'toto',
}
neutron_plugin_cisco_db_conn { 'DEFAULT/thisshouldexist' :
value => 'foo',
}
neutron_plugin_cisco_db_conn { 'DEFAULT/thisshouldnotexist' :
value => '<SERVICE DEFAULT>',
}
neutron_plugin_cisco_db_conn { 'DEFAULT/thisshouldexist2' :
value => '<SERVICE DEFAULT>',
ensure_absent_val => 'toto',
}
neutron_plugin_cisco_db_conn { 'DEFAULT/thisshouldnotexist2' :
value => 'toto',
ensure_absent_val => 'toto',
}
neutron_plugin_cisco_l2network { 'DEFAULT/thisshouldexist' :
value => 'foo',
}
neutron_plugin_cisco_l2network { 'DEFAULT/thisshouldnotexist' :
value => '<SERVICE DEFAULT>',
}
neutron_plugin_cisco_l2network { 'DEFAULT/thisshouldexist2' :
value => '<SERVICE DEFAULT>',
ensure_absent_val => 'toto',
}
neutron_plugin_cisco_l2network { 'DEFAULT/thisshouldnotexist2' :
value => 'toto',
ensure_absent_val => 'toto',
}
neutron_plugin_linuxbridge { 'DEFAULT/thisshouldexist' :
value => 'foo',
}
neutron_plugin_linuxbridge { 'DEFAULT/thisshouldnotexist' :
value => '<SERVICE DEFAULT>',
}
neutron_plugin_linuxbridge { 'DEFAULT/thisshouldexist2' :
value => '<SERVICE DEFAULT>',
ensure_absent_val => 'toto',
}
neutron_plugin_linuxbridge { 'DEFAULT/thisshouldnotexist2' :
value => 'toto',
ensure_absent_val => 'toto',
}
neutron_plugin_ml2 { 'DEFAULT/thisshouldexist' :
value => 'foo',
}
neutron_plugin_ml2 { 'DEFAULT/thisshouldnotexist' :
value => '<SERVICE DEFAULT>',
}
neutron_plugin_ml2 { 'DEFAULT/thisshouldexist2' :
value => '<SERVICE DEFAULT>',
ensure_absent_val => 'toto',
}
neutron_plugin_ml2 { 'DEFAULT/thisshouldnotexist2' :
value => 'toto',
ensure_absent_val => 'toto',
}
neutron_plugin_nvp { 'DEFAULT/thisshouldexist' :
value => 'foo',
}
neutron_plugin_nvp { 'DEFAULT/thisshouldnotexist' :
value => '<SERVICE DEFAULT>',
}
neutron_plugin_nvp { 'DEFAULT/thisshouldexist2' :
value => '<SERVICE DEFAULT>',
ensure_absent_val => 'toto',
}
neutron_plugin_nvp { 'DEFAULT/thisshouldnotexist2' :
value => 'toto',
ensure_absent_val => 'toto',
}
neutron_vpnaas_agent_config { 'DEFAULT/thisshouldexist' :
value => 'foo',
}
neutron_vpnaas_agent_config { 'DEFAULT/thisshouldnotexist' :
value => '<SERVICE DEFAULT>',
}
neutron_vpnaas_agent_config { 'DEFAULT/thisshouldexist2' :
value => '<SERVICE DEFAULT>',
ensure_absent_val => 'toto',
}
neutron_vpnaas_agent_config { 'DEFAULT/thisshouldnotexist2' :
value => 'toto',
ensure_absent_val => 'toto',
}
neutron_plugin_midonet { 'DEFAULT/thisshouldexist' :
value => 'foo',
}
neutron_plugin_midonet { 'DEFAULT/thisshouldnotexist' :
value => '<SERVICE DEFAULT>',
}
neutron_plugin_midonet { 'DEFAULT/thisshouldexist2' :
value => '<SERVICE DEFAULT>',
ensure_absent_val => 'toto',
}
neutron_plugin_midonet { 'DEFAULT/thisshouldnotexist2' :
value => 'toto',
ensure_absent_val => 'toto',
}
neutron_plugin_opencontrail { 'DEFAULT/thisshouldexist' :
value => 'foo',
}
neutron_plugin_opencontrail { 'DEFAULT/thisshouldnotexist' :
value => '<SERVICE DEFAULT>',
}
neutron_plugin_opencontrail { 'DEFAULT/thisshouldexist2' :
value => '<SERVICE DEFAULT>',
ensure_absent_val => 'toto',
}
neutron_plugin_opencontrail { 'DEFAULT/thisshouldnotexist2' :
value => 'toto',
ensure_absent_val => 'toto',
}
neutron_agent_linuxbridge { 'DEFAULT/thisshouldexist' :
value => 'foo',
}
neutron_agent_linuxbridge { 'DEFAULT/thisshouldnotexist' :
value => '<SERVICE DEFAULT>',
}
neutron_agent_linuxbridge { 'DEFAULT/thisshouldexist2' :
value => '<SERVICE DEFAULT>',
ensure_absent_val => 'toto',
}
neutron_agent_linuxbridge { 'DEFAULT/thisshouldnotexist2' :
value => 'toto',
ensure_absent_val => 'toto',
}
neutron_agent_ovs { 'DEFAULT/thisshouldexist' :
value => 'foo',
}
neutron_agent_ovs { 'DEFAULT/thisshouldnotexist' :
value => '<SERVICE DEFAULT>',
}
neutron_agent_ovs { 'DEFAULT/thisshouldexist2' :
value => '<SERVICE DEFAULT>',
ensure_absent_val => 'toto',
}
neutron_agent_ovs { 'DEFAULT/thisshouldnotexist2' :
value => 'toto',
ensure_absent_val => 'toto',
}
neutron_plugin_plumgrid { 'DEFAULT/thisshouldexist' :
value => 'foo',
}
neutron_plugin_plumgrid { 'DEFAULT/thisshouldnotexist' :
value => '<SERVICE DEFAULT>',
}
neutron_plugin_plumgrid { 'DEFAULT/thisshouldexist2' :
value => '<SERVICE DEFAULT>',
ensure_absent_val => 'toto',
}
neutron_plugin_plumgrid { 'DEFAULT/thisshouldnotexist2' :
value => 'toto',
ensure_absent_val => 'toto',
}
neutron_plumlib_plumgrid { 'DEFAULT/thisshouldexist' :
value => 'foo',
}
neutron_plumlib_plumgrid { 'DEFAULT/thisshouldnotexist' :
value => '<SERVICE DEFAULT>',
}
neutron_plumlib_plumgrid { 'DEFAULT/thisshouldexist2' :
value => '<SERVICE DEFAULT>',
ensure_absent_val => 'toto',
}
neutron_plumlib_plumgrid { 'DEFAULT/thisshouldnotexist2' :
value => 'toto',
ensure_absent_val => 'toto',
}
EOS
# Run it twice and test for idempotency
apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_changes => true)
end
$neutron_files = [ '/etc/neutron/api-paste.ini',
'/etc/neutron/neutron.conf',
'/etc/neutron/dhcp_agent.ini',
'/etc/neutron/fwaas_driver.ini',
'/etc/neutron/l3_agent.ini',
'/etc/neutron/lbaas_agent.ini',
'/etc/neutron/metadata_agent.ini',
'/etc/neutron/metering_agent.ini',
'/etc/neutron/plugins/cisco/cisco_plugins.ini',
'/etc/neutron/plugins/cisco/credentials.ini',
'/etc/neutron/plugins/cisco/db_conn.ini',
'/etc/neutron/plugins/cisco/l2network_plugin.ini',
'/etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini',
'/etc/neutron/plugins/ml2/ml2_conf.ini',
'/etc/neutron/plugins/nicira/nvp.ini',
'/etc/neutron/vpn_agent.ini',
'/etc/neutron/plugins/midonet/midonet.ini',
'/etc/neutron/plugins/opencontrail/ContrailPlugin.ini',
'/etc/neutron/plugins/plumgrid/plumgrid.ini']
$neutron_files.each do |neutron_conf_file|
describe file(neutron_conf_file) do
it { should exist }
it { should contain('thisshouldexist=foo') }
it { should contain('thisshouldexist2=<SERVICE DEFAULT>') }
its(:content) { should_not match /thisshouldnotexist/ }
end
end
end
end

View File

@ -9,6 +9,17 @@ $LOAD_PATH.push(
'inifile',
'lib')
)
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'openstacklib',
'lib')
)
require 'spec_helper'
@ -41,4 +52,23 @@ describe provider_class do
expect(provider.setting).to eq('foo')
expect(provider.file_path).to eq('/etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini')
end
it 'should ensure absent when <SERVICE DEFAULT> is specified as a value' do
resource = Puppet::Type::Neutron_agent_linuxbridge.new(
{:name => 'dude/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_agent_linuxbridge.new(
{:name => 'dude/foo', :value => 'foo', :ensure_absent_val => 'foo' }
)
provider = provider_class.new(resource)
provider.exists?
expect(resource[:ensure]).to eq :absent
end
end

View File

@ -9,6 +9,17 @@ $LOAD_PATH.push(
'inifile',
'lib')
)
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'openstacklib',
'lib')
)
require 'spec_helper'

View File

@ -0,0 +1,74 @@
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'inifile',
'lib')
)
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'openstacklib',
'lib')
)
require 'spec_helper'
provider_class = Puppet::Type.type(:neutron_api_config).provider(:ini_setting)
describe provider_class do
it 'should default to the default setting when no other one is specified' do
resource = Puppet::Type::Neutron_api_config.new(
{
:name => 'DEFAULT/foo',
:value => 'bar'
}
)
provider = provider_class.new(resource)
expect(provider.section).to eq('DEFAULT')
expect(provider.setting).to eq('foo')
expect(provider.file_path).to eq('/etc/neutron/api-paste.ini')
end
it 'should allow setting to be set explicitly' do
resource = Puppet::Type::Neutron_api_config.new(
{
:name => 'dude/foo',
:value => 'bar'
}
)
provider = provider_class.new(resource)
expect(provider.section).to eq('dude')
expect(provider.setting).to eq('foo')
expect(provider.file_path).to eq('/etc/neutron/api-paste.ini')
end
it 'should ensure absent when <SERVICE DEFAULT> is specified as a value' do
resource = Puppet::Type::Neutron_api_config.new(
{:name => 'dude/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_api_config.new(
{:name => 'dude/foo', :value => 'foo', :ensure_absent_val => 'foo' }
)
provider = provider_class.new(resource)
provider.exists?
expect(resource[:ensure]).to eq :absent
end
end

View File

@ -0,0 +1,74 @@
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'inifile',
'lib')
)
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'openstacklib',
'lib')
)
require 'spec_helper'
provider_class = Puppet::Type.type(:neutron_dhcp_agent_config).provider(:ini_setting)
describe provider_class do
it 'should default to the default setting when no other one is specified' do
resource = Puppet::Type::Neutron_dhcp_agent_config.new(
{
:name => 'DEFAULT/foo',
:value => 'bar'
}
)
provider = provider_class.new(resource)
expect(provider.section).to eq('DEFAULT')
expect(provider.setting).to eq('foo')
expect(provider.file_path).to eq('/etc/neutron/dhcp_agent.ini')
end
it 'should allow setting to be set explicitly' do
resource = Puppet::Type::Neutron_dhcp_agent_config.new(
{
:name => 'dude/foo',
:value => 'bar'
}
)
provider = provider_class.new(resource)
expect(provider.section).to eq('dude')
expect(provider.setting).to eq('foo')
expect(provider.file_path).to eq('/etc/neutron/dhcp_agent.ini')
end
it 'should ensure absent when <SERVICE DEFAULT> is specified as a value' do
resource = Puppet::Type::Neutron_dhcp_agent_config.new(
{:name => 'dude/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_dhcp_agent_config.new(
{:name => 'dude/foo', :value => 'foo', :ensure_absent_val => 'foo' }
)
provider = provider_class.new(resource)
provider.exists?
expect(resource[:ensure]).to eq :absent
end
end

View File

@ -0,0 +1,74 @@
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'inifile',
'lib')
)
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'openstacklib',
'lib')
)
require 'spec_helper'
provider_class = Puppet::Type.type(:neutron_fwaas_service_config).provider(:ini_setting)
describe provider_class do
it 'should default to the default setting when no other one is specified' do
resource = Puppet::Type::Neutron_fwaas_service_config.new(
{
:name => 'DEFAULT/foo',
:value => 'bar'
}
)
provider = provider_class.new(resource)
expect(provider.section).to eq('DEFAULT')
expect(provider.setting).to eq('foo')
expect(provider.file_path).to eq('/etc/neutron/fwaas_driver.ini')
end
it 'should allow setting to be set explicitly' do
resource = Puppet::Type::Neutron_fwaas_service_config.new(
{
:name => 'dude/foo',
:value => 'bar'
}
)
provider = provider_class.new(resource)
expect(provider.section).to eq('dude')
expect(provider.setting).to eq('foo')
expect(provider.file_path).to eq('/etc/neutron/fwaas_driver.ini')
end
it 'should ensure absent when <SERVICE DEFAULT> is specified as a value' do
resource = Puppet::Type::Neutron_fwaas_service_config.new(
{:name => 'dude/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_fwaas_service_config.new(
{:name => 'dude/foo', :value => 'foo', :ensure_absent_val => 'foo' }
)
provider = provider_class.new(resource)
provider.exists?
expect(resource[:ensure]).to eq :absent
end
end

View File

@ -0,0 +1,74 @@
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'inifile',
'lib')
)
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'openstacklib',
'lib')
)
require 'spec_helper'
provider_class = Puppet::Type.type(:neutron_l3_agent_config).provider(:ini_setting)
describe provider_class do
it 'should default to the default setting when no other one is specified' do
resource = Puppet::Type::Neutron_l3_agent_config.new(
{
:name => 'DEFAULT/foo',
:value => 'bar'
}
)
provider = provider_class.new(resource)
expect(provider.section).to eq('DEFAULT')
expect(provider.setting).to eq('foo')
expect(provider.file_path).to eq('/etc/neutron/l3_agent.ini')
end
it 'should allow setting to be set explicitly' do
resource = Puppet::Type::Neutron_l3_agent_config.new(
{
:name => 'dude/foo',
:value => 'bar'
}
)
provider = provider_class.new(resource)
expect(provider.section).to eq('dude')
expect(provider.setting).to eq('foo')
expect(provider.file_path).to eq('/etc/neutron/l3_agent.ini')
end
it 'should ensure absent when <SERVICE DEFAULT> is specified as a value' do
resource = Puppet::Type::Neutron_l3_agent_config.new(
{:name => 'dude/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_l3_agent_config.new(
{:name => 'dude/foo', :value => 'foo', :ensure_absent_val => 'foo' }
)
provider = provider_class.new(resource)
provider.exists?
expect(resource[:ensure]).to eq :absent
end
end

View File

@ -0,0 +1,74 @@
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'inifile',
'lib')
)
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'openstacklib',
'lib')
)
require 'spec_helper'
provider_class = Puppet::Type.type(:neutron_lbaas_agent_config).provider(:ini_setting)
describe provider_class do
it 'should default to the default setting when no other one is specified' do
resource = Puppet::Type::Neutron_lbaas_agent_config.new(
{
:name => 'DEFAULT/foo',
:value => 'bar'
}
)
provider = provider_class.new(resource)
expect(provider.section).to eq('DEFAULT')
expect(provider.setting).to eq('foo')
expect(provider.file_path).to eq('/etc/neutron/lbaas_agent.ini')
end
it 'should allow setting to be set explicitly' do
resource = Puppet::Type::Neutron_lbaas_agent_config.new(
{
:name => 'dude/foo',
:value => 'bar'
}
)
provider = provider_class.new(resource)
expect(provider.section).to eq('dude')
expect(provider.setting).to eq('foo')
expect(provider.file_path).to eq('/etc/neutron/lbaas_agent.ini')
end
it 'should ensure absent when <SERVICE DEFAULT> is specified as a value' do
resource = Puppet::Type::Neutron_lbaas_agent_config.new(
{:name => 'dude/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_lbaas_agent_config.new(
{:name => 'dude/foo', :value => 'foo', :ensure_absent_val => 'foo' }
)
provider = provider_class.new(resource)
provider.exists?
expect(resource[:ensure]).to eq :absent
end
end

View File

@ -0,0 +1,74 @@
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'inifile',
'lib')
)
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'openstacklib',
'lib')
)
require 'spec_helper'
provider_class = Puppet::Type.type(:neutron_metadata_agent_config).provider(:ini_setting)
describe provider_class do
it 'should default to the default setting when no other one is specified' do
resource = Puppet::Type::Neutron_metadata_agent_config.new(
{
:name => 'DEFAULT/foo',
:value => 'bar'
}
)
provider = provider_class.new(resource)
expect(provider.section).to eq('DEFAULT')
expect(provider.setting).to eq('foo')
expect(provider.file_path).to eq('/etc/neutron/metadata_agent.ini')
end
it 'should allow setting to be set explicitly' do
resource = Puppet::Type::Neutron_metadata_agent_config.new(
{
:name => 'dude/foo',
:value => 'bar'
}
)
provider = provider_class.new(resource)
expect(provider.section).to eq('dude')
expect(provider.setting).to eq('foo')
expect(provider.file_path).to eq('/etc/neutron/metadata_agent.ini')
end
it 'should ensure absent when <SERVICE DEFAULT> is specified as a value' do
resource = Puppet::Type::Neutron_metadata_agent_config.new(
{:name => 'dude/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_metadata_agent_config.new(
{:name => 'dude/foo', :value => 'foo', :ensure_absent_val => 'foo' }
)
provider = provider_class.new(resource)
provider.exists?
expect(resource[:ensure]).to eq :absent
end
end

View File

@ -0,0 +1,74 @@
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'inifile',
'lib')
)
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'openstacklib',
'lib')
)
require 'spec_helper'
provider_class = Puppet::Type.type(:neutron_metering_agent_config).provider(:ini_setting)
describe provider_class do
it 'should default to the default setting when no other one is specified' do
resource = Puppet::Type::Neutron_metering_agent_config.new(
{
:name => 'DEFAULT/foo',
:value => 'bar'
}
)
provider = provider_class.new(resource)
expect(provider.section).to eq('DEFAULT')
expect(provider.setting).to eq('foo')
expect(provider.file_path).to eq('/etc/neutron/metering_agent.ini')
end
it 'should allow setting to be set explicitly' do
resource = Puppet::Type::Neutron_metering_agent_config.new(
{
:name => 'dude/foo',
:value => 'bar'
}
)
provider = provider_class.new(resource)
expect(provider.section).to eq('dude')
expect(provider.setting).to eq('foo')
expect(provider.file_path).to eq('/etc/neutron/metering_agent.ini')
end
it 'should ensure absent when <SERVICE DEFAULT> is specified as a value' do
resource = Puppet::Type::Neutron_metering_agent_config.new(
{:name => 'dude/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_metering_agent_config.new(
{:name => 'dude/foo', :value => 'foo', :ensure_absent_val => 'foo' }
)
provider = provider_class.new(resource)
provider.exists?
expect(resource[:ensure]).to eq :absent
end
end

View File

@ -0,0 +1,74 @@
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'inifile',
'lib')
)
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'openstacklib',
'lib')
)
require 'spec_helper'
provider_class = Puppet::Type.type(:neutron_plugin_cisco).provider(:ini_setting)
describe provider_class do
it 'should default to the default setting when no other one is specified' do
resource = Puppet::Type::Neutron_plugin_cisco.new(
{
:name => 'DEFAULT/foo',
:value => 'bar'
}
)
provider = provider_class.new(resource)
expect(provider.section).to eq('DEFAULT')
expect(provider.setting).to eq('foo')
expect(provider.file_path).to eq('/etc/neutron/plugins/cisco/cisco_plugins.ini')
end
it 'should allow setting to be set explicitly' do
resource = Puppet::Type::Neutron_plugin_cisco.new(
{
:name => 'dude/foo',
:value => 'bar'
}
)
provider = provider_class.new(resource)
expect(provider.section).to eq('dude')
expect(provider.setting).to eq('foo')
expect(provider.file_path).to eq('/etc/neutron/plugins/cisco/cisco_plugins.ini')
end
it 'should ensure absent when <SERVICE DEFAULT> is specified as a value' do
resource = Puppet::Type::Neutron_plugin_cisco.new(
{:name => 'dude/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_cisco.new(
{:name => 'dude/foo', :value => 'foo', :ensure_absent_val => 'foo' }
)
provider = provider_class.new(resource)
provider.exists?
expect(resource[:ensure]).to eq :absent
end
end

View File

@ -0,0 +1,74 @@
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'inifile',
'lib')
)
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'openstacklib',
'lib')
)
require 'spec_helper'
provider_class = Puppet::Type.type(:neutron_plugin_cisco_credentials).provider(:ini_setting)
describe provider_class do
it 'should default to the default setting when no other one is specified' do
resource = Puppet::Type::Neutron_plugin_cisco_credentials.new(
{
:name => 'DEFAULT/foo',
:value => 'bar'
}
)
provider = provider_class.new(resource)
expect(provider.section).to eq('DEFAULT')
expect(provider.setting).to eq('foo')
expect(provider.file_path).to eq('/etc/neutron/plugins/cisco/credentials.ini')
end
it 'should allow setting to be set explicitly' do
resource = Puppet::Type::Neutron_plugin_cisco_credentials.new(
{
:name => 'dude/foo',
:value => 'bar'
}
)
provider = provider_class.new(resource)
expect(provider.section).to eq('dude')
expect(provider.setting).to eq('foo')
expect(provider.file_path).to eq('/etc/neutron/plugins/cisco/credentials.ini')
end
it 'should ensure absent when <SERVICE DEFAULT> is specified as a value' do
resource = Puppet::Type::Neutron_plugin_cisco_credentials.new(
{:name => 'dude/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_cisco_credentials.new(
{:name => 'dude/foo', :value => 'foo', :ensure_absent_val => 'foo' }
)
provider = provider_class.new(resource)
provider.exists?
expect(resource[:ensure]).to eq :absent
end
end

View File

@ -0,0 +1,74 @@
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'inifile',
'lib')
)
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'openstacklib',
'lib')
)
require 'spec_helper'
provider_class = Puppet::Type.type(:neutron_plugin_cisco_db_conn).provider(:ini_setting)
describe provider_class do
it 'should default to the default setting when no other one is specified' do
resource = Puppet::Type::Neutron_plugin_cisco_db_conn.new(
{
:name => 'DEFAULT/foo',
:value => 'bar'
}
)
provider = provider_class.new(resource)
expect(provider.section).to eq('DEFAULT')
expect(provider.setting).to eq('foo')
expect(provider.file_path).to eq('/etc/neutron/plugins/cisco/db_conn.ini')
end
it 'should allow setting to be set explicitly' do
resource = Puppet::Type::Neutron_plugin_cisco_db_conn.new(
{
:name => 'dude/foo',
:value => 'bar'
}
)
provider = provider_class.new(resource)
expect(provider.section).to eq('dude')
expect(provider.setting).to eq('foo')
expect(provider.file_path).to eq('/etc/neutron/plugins/cisco/db_conn.ini')
end
it 'should ensure absent when <SERVICE DEFAULT> is specified as a value' do
resource = Puppet::Type::Neutron_plugin_cisco_db_conn.new(
{:name => 'dude/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_cisco_db_conn.new(
{:name => 'dude/foo', :value => 'foo', :ensure_absent_val => 'foo' }
)
provider = provider_class.new(resource)
provider.exists?
expect(resource[:ensure]).to eq :absent
end
end

View File

@ -0,0 +1,74 @@
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'inifile',
'lib')
)
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'openstacklib',
'lib')
)
require 'spec_helper'
provider_class = Puppet::Type.type(:neutron_plugin_cisco_l2network).provider(:ini_setting)
describe provider_class do
it 'should default to the default setting when no other one is specified' do
resource = Puppet::Type::Neutron_plugin_cisco_l2network.new(
{
:name => 'DEFAULT/foo',
:value => 'bar'
}
)
provider = provider_class.new(resource)
expect(provider.section).to eq('DEFAULT')
expect(provider.setting).to eq('foo')
expect(provider.file_path).to eq('/etc/neutron/plugins/cisco/l2network_plugin.ini')
end
it 'should allow setting to be set explicitly' do
resource = Puppet::Type::Neutron_plugin_cisco_l2network.new(
{
:name => 'dude/foo',
:value => 'bar'
}
)
provider = provider_class.new(resource)
expect(provider.section).to eq('dude')
expect(provider.setting).to eq('foo')
expect(provider.file_path).to eq('/etc/neutron/plugins/cisco/l2network_plugin.ini')
end
it 'should ensure absent when <SERVICE DEFAULT> is specified as a value' do
resource = Puppet::Type::Neutron_plugin_cisco_l2network.new(
{:name => 'dude/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_cisco_l2network.new(
{:name => 'dude/foo', :value => 'foo', :ensure_absent_val => 'foo' }
)
provider = provider_class.new(resource)
provider.exists?
expect(resource[:ensure]).to eq :absent
end
end

View File

@ -0,0 +1,74 @@
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'inifile',
'lib')
)
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'openstacklib',
'lib')
)
require 'spec_helper'
provider_class = Puppet::Type.type(:neutron_plugin_midonet).provider(:ini_setting)
describe provider_class do
it 'should default to the default setting when no other one is specified' do
resource = Puppet::Type::Neutron_plugin_midonet.new(
{
:name => 'DEFAULT/foo',
:value => 'bar'
}
)
provider = provider_class.new(resource)
expect(provider.section).to eq('DEFAULT')
expect(provider.setting).to eq('foo')
expect(provider.file_path).to eq('/etc/neutron/plugins/midonet/midonet.ini')
end
it 'should allow setting to be set explicitly' do
resource = Puppet::Type::Neutron_plugin_midonet.new(
{
:name => 'dude/foo',
:value => 'bar'
}
)
provider = provider_class.new(resource)
expect(provider.section).to eq('dude')
expect(provider.setting).to eq('foo')
expect(provider.file_path).to eq('/etc/neutron/plugins/midonet/midonet.ini')
end
it 'should ensure absent when <SERVICE DEFAULT> is specified as a value' do
resource = Puppet::Type::Neutron_plugin_midonet.new(
{:name => 'dude/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_midonet.new(
{:name => 'dude/foo', :value => 'foo', :ensure_absent_val => 'foo' }
)
provider = provider_class.new(resource)
provider.exists?
expect(resource[:ensure]).to eq :absent
end
end

View File

@ -0,0 +1,74 @@
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'inifile',
'lib')
)
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'openstacklib',
'lib')
)
require 'spec_helper'
provider_class = Puppet::Type.type(:neutron_plugin_ml2).provider(:ini_setting)
describe provider_class do
it 'should default to the default setting when no other one is specified' do
resource = Puppet::Type::Neutron_plugin_ml2.new(
{
:name => 'DEFAULT/foo',
:value => 'bar'
}
)
provider = provider_class.new(resource)
expect(provider.section).to eq('DEFAULT')
expect(provider.setting).to eq('foo')
expect(provider.file_path).to eq('/etc/neutron/plugins/ml2/ml2_conf.ini')
end
it 'should allow setting to be set explicitly' do
resource = Puppet::Type::Neutron_plugin_ml2.new(
{
:name => 'dude/foo',
:value => 'bar'
}
)
provider = provider_class.new(resource)
expect(provider.section).to eq('dude')
expect(provider.setting).to eq('foo')
expect(provider.file_path).to eq('/etc/neutron/plugins/ml2/ml2_conf.ini')
end
it 'should ensure absent when <SERVICE DEFAULT> is specified as a value' do
resource = Puppet::Type::Neutron_plugin_ml2.new(
{:name => 'dude/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_ml2.new(
{:name => 'dude/foo', :value => 'foo', :ensure_absent_val => 'foo' }
)
provider = provider_class.new(resource)
provider.exists?
expect(resource[:ensure]).to eq :absent
end
end

View File

@ -0,0 +1,74 @@
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'inifile',
'lib')
)
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'openstacklib',
'lib')
)
require 'spec_helper'
provider_class = Puppet::Type.type(:neutron_plugin_nvp).provider(:ini_setting)
describe provider_class do
it 'should default to the default setting when no other one is specified' do
resource = Puppet::Type::Neutron_plugin_nvp.new(
{
:name => 'DEFAULT/foo',
:value => 'bar'
}
)
provider = provider_class.new(resource)
expect(provider.section).to eq('DEFAULT')
expect(provider.setting).to eq('foo')
expect(provider.file_path).to eq('/etc/neutron/plugins/nicira/nvp.ini')
end
it 'should allow setting to be set explicitly' do
resource = Puppet::Type::Neutron_plugin_nvp.new(
{
:name => 'dude/foo',
:value => 'bar'
}
)
provider = provider_class.new(resource)
expect(provider.section).to eq('dude')
expect(provider.setting).to eq('foo')
expect(provider.file_path).to eq('/etc/neutron/plugins/nicira/nvp.ini')
end
it 'should ensure absent when <SERVICE DEFAULT> is specified as a value' do
resource = Puppet::Type::Neutron_plugin_nvp.new(
{:name => 'dude/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_nvp.new(
{:name => 'dude/foo', :value => 'foo', :ensure_absent_val => 'foo' }
)
provider = provider_class.new(resource)
provider.exists?
expect(resource[:ensure]).to eq :absent
end
end

View File

@ -9,6 +9,17 @@ $LOAD_PATH.push(
'inifile',
'lib')
)
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'openstacklib',
'lib')
)
require 'spec_helper'

View File

@ -9,6 +9,17 @@ $LOAD_PATH.push(
'inifile',
'lib')
)
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'openstacklib',
'lib')
)
require 'spec_helper'

View File

@ -9,6 +9,17 @@ $LOAD_PATH.push(
'inifile',
'lib')
)
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'openstacklib',
'lib')
)
require 'spec_helper'

View File

@ -0,0 +1,74 @@
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'inifile',
'lib')
)
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'openstacklib',
'lib')
)
require 'spec_helper'
provider_class = Puppet::Type.type(:neutron_vpnaas_agent_config).provider(:ini_setting)
describe provider_class do
it 'should default to the default setting when no other one is specified' do
resource = Puppet::Type::Neutron_vpnaas_agent_config.new(
{
:name => 'DEFAULT/foo',
:value => 'bar'
}
)
provider = provider_class.new(resource)
expect(provider.section).to eq('DEFAULT')
expect(provider.setting).to eq('foo')
expect(provider.file_path).to eq('/etc/neutron/vpn_agent.ini')
end
it 'should allow setting to be set explicitly' do
resource = Puppet::Type::Neutron_vpnaas_agent_config.new(
{
:name => 'dude/foo',
:value => 'bar'
}
)
provider = provider_class.new(resource)
expect(provider.section).to eq('dude')
expect(provider.setting).to eq('foo')
expect(provider.file_path).to eq('/etc/neutron/vpn_agent.ini')
end
it 'should ensure absent when <SERVICE DEFAULT> is specified as a value' do
resource = Puppet::Type::Neutron_vpnaas_agent_config.new(
{:name => 'dude/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_vpnaas_agent_config.new(
{:name => 'dude/foo', :value => 'foo', :ensure_absent_val => 'foo' }
)
provider = provider_class.new(resource)
provider.exists?
expect(resource[:ensure]).to eq :absent
end
end

View File

@ -32,12 +32,12 @@ tenants_response = {
]
}
# Stub for ini_setting resource
Puppet::Type.newtype(:ini_setting) do
# Stub for openstack_config resource
Puppet::Type.newtype(:openstack_config) do
end
# Stub for ini_setting provider
Puppet::Type.newtype(:ini_setting).provide(:ruby) do
# Stub for openstack_config provider
Puppet::Type.newtype(:openstack_config).provide(:ini_setting) do
def create
end
end