From ef3ca7f93c29ebe6fbf40788cc4d4bc72182e2a2 Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Fri, 19 Sep 2014 20:01:37 -0400 Subject: [PATCH] /etc/default/neutron-server file is only on Ubuntu packages The /etc/default/neutron-server file is only present in Ubuntu packages, not in Debian. Let's change the fact to detect Ubuntu instead of Debian operating system. Change-Id: Iac73b475bfc8ac7f9f97a858ab836a4d07afac5f --- manifests/plugins/cisco.pp | 2 +- manifests/plugins/linuxbridge.pp | 2 +- manifests/plugins/ml2.pp | 2 +- spec/classes/neutron_plugins_cisco_spec.rb | 29 +++++++++++++---- .../neutron_plugins_linuxbridge_spec.rb | 31 ++++++++++++++----- spec/classes/neutron_plugins_ml2_spec.rb | 24 ++++++++------ 6 files changed, 64 insertions(+), 26 deletions(-) diff --git a/manifests/plugins/cisco.pp b/manifests/plugins/cisco.pp index a0ff23606..3db672e25 100644 --- a/manifests/plugins/cisco.pp +++ b/manifests/plugins/cisco.pp @@ -109,7 +109,7 @@ Package['neutron'] -> Neutron_plugin_cisco_l2network<||> } - if $::osfamily == 'Debian' { + if $::operatingsystem == 'Ubuntu' { file_line { '/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG': path => '/etc/default/neutron-server', match => '^NEUTRON_PLUGIN_CONFIG=(.*)$', diff --git a/manifests/plugins/linuxbridge.pp b/manifests/plugins/linuxbridge.pp index f784f6804..caf4696bc 100644 --- a/manifests/plugins/linuxbridge.pp +++ b/manifests/plugins/linuxbridge.pp @@ -35,7 +35,7 @@ Neutron_plugin_linuxbridge<||> ~> Service<| title == 'neutron-server' |> Package['neutron-plugin-linuxbridge'] -> Service<| title == 'neutron-server' |> - if $::osfamily == 'Debian' { + if $::operatingsystem == 'Ubuntu' { file_line { '/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG': path => '/etc/default/neutron-server', match => '^NEUTRON_PLUGIN_CONFIG=(.*)$', diff --git a/manifests/plugins/ml2.pp b/manifests/plugins/ml2.pp index 80ea05f30..127a053b5 100644 --- a/manifests/plugins/ml2.pp +++ b/manifests/plugins/ml2.pp @@ -111,7 +111,7 @@ warning('Without networking mechanism driver, ml2 will not communicate with L2 agents') } - if $::osfamily == 'Debian' { + if $::operatingsystem == 'Ubuntu' { file_line { '/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG': path => '/etc/default/neutron-server', match => '^NEUTRON_PLUGIN_CONFIG=(.*)$', diff --git a/spec/classes/neutron_plugins_cisco_spec.rb b/spec/classes/neutron_plugins_cisco_spec.rb index aea63cb7c..86430919d 100644 --- a/spec/classes/neutron_plugins_cisco_spec.rb +++ b/spec/classes/neutron_plugins_cisco_spec.rb @@ -134,12 +134,29 @@ class { 'neutron': rabbit_password => 'passw0rd' }" { :osfamily => 'Debian' } end - it_configures 'default cisco plugin' - it 'configures /etc/default/neutron-server' do - should contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').with( - :line => 'NEUTRON_PLUGIN_CONFIG=/etc/neutron/plugins/cisco/cisco_plugins.ini', - :require => ['Package[neutron-server]', 'Package[neutron-plugin-cisco]'] - ) + context 'on Ubuntu operating systems' do + before do + facts.merge!({:operatingsystem => 'Ubuntu'}) + 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/cisco/cisco_plugins.ini', + :require => ['Package[neutron-server]', 'Package[neutron-plugin-cisco]'], + :notify => 'Service[neutron-server]' + ) + end + it_configures 'default cisco plugin' + end + + context 'on Debian operating systems' do + before do + facts.merge!({:operatingsystem => 'Debian'}) + end + + it_configures 'default cisco plugin' end end diff --git a/spec/classes/neutron_plugins_linuxbridge_spec.rb b/spec/classes/neutron_plugins_linuxbridge_spec.rb index bbe0480e4..c27aab8c0 100644 --- a/spec/classes/neutron_plugins_linuxbridge_spec.rb +++ b/spec/classes/neutron_plugins_linuxbridge_spec.rb @@ -41,10 +41,8 @@ :require => 'Package[neutron-plugin-linuxbridge]' ) end - end - context 'on Debian platforms' do let :facts do { :osfamily => 'Debian' } @@ -54,12 +52,29 @@ { :linuxbridge_plugin_package => 'neutron-plugin-linuxbridge' } end - it_configures 'neutron linuxbridge plugin' - it 'configures /etc/default/neutron-server' do - should contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').with( - :line => 'NEUTRON_PLUGIN_CONFIG=/etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini', - :require => ['Package[neutron-plugin-linuxbridge]', 'Package[neutron-server]'] - ) + context 'on Ubuntu operating systems' do + before do + facts.merge!({:operatingsystem => 'Ubuntu'}) + 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/linuxbridge/linuxbridge_conf.ini', + :require => ['Package[neutron-plugin-linuxbridge]', 'Package[neutron-server]'], + :notify => 'Service[neutron-server]' + ) + end + it_configures 'neutron linuxbridge plugin' + end + + context 'on Debian operating systems' do + before do + facts.merge!({:operatingsystem => 'Debian'}) + end + + it_configures 'neutron linuxbridge plugin' end end diff --git a/spec/classes/neutron_plugins_ml2_spec.rb b/spec/classes/neutron_plugins_ml2_spec.rb index 466de4bcb..10c6d6b72 100644 --- a/spec/classes/neutron_plugins_ml2_spec.rb +++ b/spec/classes/neutron_plugins_ml2_spec.rb @@ -182,6 +182,21 @@ end end end + + context 'on Ubuntu operating systems' do + before do + facts.merge!({:operatingsystem => 'Ubuntu'}) + 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/plugin.ini', + :require => ['File[/etc/neutron/plugin.ini]'] + ) + end + end end context 'on Debian platforms' do @@ -193,15 +208,6 @@ {} 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/plugin.ini', - :require => ['File[/etc/neutron/plugin.ini]'] - ) - end - context 'on Ubuntu operating systems' do before do facts.merge!({:operatingsystem => 'Ubuntu'})