Set sane defaults for linuxbridge_conf.ini
These defaults are based on upstream documentation [1] and should work in most environments. In addition, add RHEL chefspec tests and also test the config file contents. Without a default config of any kind, the plugin_config recipe fails due to an empty attribute. [1] http://docs.openstack.org/mitaka/install-guide-rdo/neutron.html Change-Id: I037e51f40db5f73c8b9a3f6289287e82fb73f8a6 Signed-off-by: Lance Albertson <lance@osuosl.org>
This commit is contained in:
parent
cace7ca3de
commit
8e42ee27c0
|
@ -40,6 +40,8 @@ node.default['openstack']['network']['plugins']['linuxbridge'].tap do |lb|
|
|||
'/etc/neutron/plugins/linuxbridge'
|
||||
lb['filename'] =
|
||||
'linuxbridge_conf.ini'
|
||||
lb['conf']['securitygroup']['firewall_driver'] =
|
||||
'neutron.agent.linux.iptables_firewall.IptablesFirewallDriver'
|
||||
end
|
||||
|
||||
include_recipe 'openstack-network::plugin_config'
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
# pkg upgrade
|
||||
|
||||
# service
|
||||
|
||||
# Encoding: utf-8
|
||||
require_relative 'spec_helper'
|
||||
|
||||
describe 'openstack-network::ml2_linuxbridge' do
|
||||
describe 'redhat' do
|
||||
let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
|
||||
let(:node) { runner.node }
|
||||
let(:chef_run) do
|
||||
runner.converge(described_recipe)
|
||||
end
|
||||
|
||||
include_context 'neutron-stubs'
|
||||
|
||||
before do
|
||||
node.set['openstack']['network']['plugins']['linuxbridge']['path'] =
|
||||
'/etc/neutron/plugins/linuxbridge'
|
||||
node.set['openstack']['network']['plugins']['linuxbridge']['filename'] =
|
||||
'linuxbridge_conf.ini'
|
||||
end
|
||||
it 'creates the /etc/neutron/plugins/linuxbridge agent directory' do
|
||||
expect(chef_run).to create_directory('/etc/neutron/plugins/linuxbridge').with(
|
||||
owner: 'neutron',
|
||||
group: 'neutron',
|
||||
mode: 0700
|
||||
)
|
||||
end
|
||||
it do
|
||||
expect(chef_run).to include_recipe('openstack-network::plugin_config')
|
||||
end
|
||||
|
||||
describe '/etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini' do
|
||||
let(:file) do
|
||||
chef_run.template('/etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini')
|
||||
end
|
||||
[
|
||||
/^firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver$/
|
||||
].each do |line|
|
||||
it do
|
||||
expect(chef_run).to render_config_file(file.name)
|
||||
.with_section_content('securitygroup', line)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
it do
|
||||
%w(openstack-neutron-linuxbridge iproute).each do |pkg|
|
||||
expect(chef_run).to upgrade_package(pkg)
|
||||
end
|
||||
end
|
||||
|
||||
it do
|
||||
expect(chef_run).to enable_service('neutron-linuxbridge-agent')
|
||||
end
|
||||
it do
|
||||
service = chef_run.service('neutron-linuxbridge-agent')
|
||||
expect(service).to(subscribe_to('template[/etc/neutron/neutron.conf]').on(:restart).delayed) && subscribe_to('template[/etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini]').on(:restart).delayed
|
||||
end
|
||||
end
|
||||
end
|
|
@ -33,6 +33,20 @@ describe 'openstack-network::ml2_linuxbridge' do
|
|||
expect(chef_run).to include_recipe('openstack-network::plugin_config')
|
||||
end
|
||||
|
||||
describe '/etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini' do
|
||||
let(:file) do
|
||||
chef_run.template('/etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini')
|
||||
end
|
||||
[
|
||||
/^firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver$/
|
||||
].each do |line|
|
||||
it do
|
||||
expect(chef_run).to render_config_file(file.name)
|
||||
.with_section_content('securitygroup', line)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
it do
|
||||
%w(neutron-plugin-linuxbridge neutron-plugin-linuxbridge-agent).each do |pkg|
|
||||
expect(chef_run).to upgrade_package(pkg)
|
||||
|
|
Loading…
Reference in New Issue