Do not create /etc/default/neutron-server in CentOS/RHEL

... because the file is not used in these operating systems.

Change-Id: Iaba23fe52679e92017fb1a489635c8b2d95334b3
This commit is contained in:
Takashi Kajinami 2022-08-22 02:46:57 +09:00
parent 581f6a3149
commit 6aa4204663
5 changed files with 87 additions and 49 deletions

View File

@ -155,6 +155,15 @@ class neutron::plugins::ml2 (
}
# lint:endignore
if $::osfamily == 'Debian' {
file {'/etc/default/neutron-server':
ensure => present,
owner => 'root',
group => 'root',
mode => '0644',
tag => 'neutron-config-file',
}
}
if $::operatingsystem == 'Ubuntu' {
file_line { '/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG':
path => '/etc/default/neutron-server',
@ -171,13 +180,6 @@ class neutron::plugins::ml2 (
target => '/etc/neutron/plugins/ml2/ml2_conf.ini',
tag => 'neutron-config-file',
}
file {'/etc/default/neutron-server':
ensure => present,
owner => 'root',
group => 'root',
mode => '0644',
tag => 'neutron-config-file',
}
# Some platforms do not have a dedicated ml2 plugin package
if $::neutron::params::ml2_server_package {

View File

@ -69,6 +69,7 @@ class neutron::plugins::ml2::nuage (
file_line { 'neutron-server-DAEMON_ARGS':
path => '/etc/default/neutron-server',
line => 'DAEMON_ARGS="$DAEMON_ARGS --config-file /etc/neutron/plugins/nuage/plugin.ini"',
tag => 'neutron-file-line'
}
}

View File

@ -59,13 +59,6 @@ describe 'neutron::plugins::ml2::nuage' do
should contain_neutron_plugin_nuage('PLUGIN/default_allow_non_ip').with_value(params[:nuage_default_allow_non_ip])
end
it 'should have a nuage plugin conf file' do
should contain_file(platform_params[:nuage_conf_file]).with(
:ensure => platform_params[:nuage_file_ensure],
:target => platform_params[:nuage_file_target]
)
end
context 'when allowing Non-IP' do
before :each do
params.merge!(:nuage_default_allow_non_ip => true)
@ -76,6 +69,28 @@ describe 'neutron::plugins::ml2::nuage' do
end
end
shared_examples 'neutron plugin ml2 nuage on Debian' do
it 'configures /etc/default/neutron-server' do
should contain_file_line('neutron-server-DAEMON_ARGS').with(
:path => '/etc/default/neutron-server',
:line => 'DAEMON_ARGS="$DAEMON_ARGS --config-file /etc/neutron/plugins/nuage/plugin.ini"',
:tag => 'neutron-file-line',
)
should contain_file_line('neutron-server-DAEMON_ARGS').that_requires('Anchor[neutron::config::begin]')
should contain_file_line('neutron-server-DAEMON_ARGS').that_notifies('Anchor[neutron::config::end]')
end
end
shared_examples 'neutron plugin ml2 nuage on RedHat' do
it 'should create plugin symbolic link' do
should contain_file('/etc/neutron/conf.d/neutron-server/nuage_plugin.conf').with(
:ensure => 'link',
:target => '/etc/neutron/plugins/nuage/plugin.ini',
:tag => 'neutron-config-file'
)
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
@ -84,22 +99,8 @@ describe 'neutron::plugins::ml2::nuage' do
facts.merge!(OSDefaults.get_facts())
end
let (:platform_params) do
case facts[:osfamily]
when 'RedHat'
{ :nuage_conf_file => '/etc/neutron/conf.d/neutron-server/nuage_plugin.conf',
:nuage_file_ensure => 'link',
:nuage_file_target => '/etc/neutron/plugins/nuage/plugin.ini'
}
when 'Debian'
{ :nuage_conf_file => '/etc/default/neutron-server',
:nuage_file_ensure => 'present',
:nuage_file_target => nil
}
end
end
it_behaves_like 'neutron plugin ml2 nuage'
it_behaves_like "neutron plugin ml2 nuage on #{facts[:osfamily]}"
end
end
end

View File

@ -276,17 +276,38 @@ describe 'neutron::plugins::ml2' do
end
end
end
end
shared_examples 'neutron plugin ml2 on Debian' do
context 'on Ubuntu operating systems' do
before do
facts.merge!({:operatingsystem => 'Ubuntu'})
end
it 'configures /etc/default/neutron-server' do
should contain_file('/etc/default/neutron-server').with(
:ensure => 'present',
:owner => 'root',
:group => 'root',
:mode => '0644',
:tag => 'neutron-config-file',
)
should_not contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG')
end
end
end
shared_examples 'neutron plugin ml2 on Ubuntu' do
context 'on Ubuntu operating systems' do
it 'configures /etc/default/neutron-server' do
should contain_file('/etc/default/neutron-server').with(
:ensure => 'present',
:owner => 'root',
:group => 'root',
:mode => '0644',
:tag => 'neutron-config-file',
)
should contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').with(
:path => '/etc/default/neutron-server',
:match => '^NEUTRON_PLUGIN_CONFIG=(.*)$',
:line => 'NEUTRON_PLUGIN_CONFIG=/etc/neutron/plugin.ini',
:tag => 'neutron-file-line',
)
should contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').that_requires('Anchor[neutron::config::begin]')
should contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').that_notifies('Anchor[neutron::config::end]')
@ -294,6 +315,15 @@ describe 'neutron::plugins::ml2' do
end
end
shared_examples 'neutron plugin ml2 on RedHat' do
context 'on Ubuntu operating systems' do
it 'should not configure /etc/default/neutron-server' do
should_not contain_file('/etc/default/neutron-server')
should_not contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG')
end
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
@ -320,6 +350,12 @@ describe 'neutron::plugins::ml2' do
end
it_behaves_like 'neutron plugin ml2'
if facts[:osfamily] == 'Debian'
it_behaves_like "neutron plugin ml2 on #{facts[:operatingsystem]}"
else
it_behaves_like "neutron plugin ml2 on #{facts[:osfamily]}"
end
end
end
end

View File

@ -120,26 +120,24 @@ describe 'neutron::plugins::nsx' do
end
shared_examples 'neutron plugin nsx on Debian' do
context 'with defaults' do
it 'configures /etc/default/neutron-server' do
should contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').with(
:path => '/etc/default/neutron-server',
:match => '^NEUTRON_PLUGIN_CONFIG=(.*)$',
:line => 'NEUTRON_PLUGIN_CONFIG=/etc/neutron/plugins/vmware/nsx.ini',
)
should contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').that_requires('Anchor[neutron::config::begin]')
should contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').that_notifies('Anchor[neutron::config::end]')
end
it 'configures /etc/default/neutron-server' do
should contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').with(
:path => '/etc/default/neutron-server',
:match => '^NEUTRON_PLUGIN_CONFIG=(.*)$',
:line => 'NEUTRON_PLUGIN_CONFIG=/etc/neutron/plugins/vmware/nsx.ini',
)
should contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').that_requires('Anchor[neutron::config::begin]')
should contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').that_notifies('Anchor[neutron::config::end]')
end
end
shared_examples 'neutron plugin nsx on RedHat' do
context 'with defaults' do
it 'should create plugin symbolic link' do
should contain_file('/etc/neutron/plugin.ini').with(
:ensure => 'link',
:target => '/etc/neutron/plugins/vmware/nsx.ini')
end
it 'should create plugin symbolic link' do
should contain_file('/etc/neutron/plugin.ini').with(
:ensure => 'link',
:target => '/etc/neutron/plugins/vmware/nsx.ini',
:tag => 'neutron-config-file',
)
end
end