dnsmasq attributes defined in wrong order

Allow this to be skipped if version is nil.  Some
repos provide their own version of dnsmasq package.

Change-Id: Ibeb847613b4dabbe5e8570302feb7d0bfc8935b2
Closes-Bug: #1441310
This commit is contained in:
Mark Vanderwiel
2015-04-07 14:33:33 -05:00
committed by Ma Wen Cheng
parent 3d677e5190
commit d98525a6c7
3 changed files with 9 additions and 4 deletions

View File

@@ -298,8 +298,8 @@ default['openstack']['network']['dhcp']['enable_metadata_network'] = 'False'
# the version of dnsmasq for centos 6.5 is two revs behind where the dhcp-agent needs
# to run properly. This is a version that allows and starts the dhcp-agent correctly.
default['openstack']['network']['dhcp']['dnsmasq_rpm_source'] = "http://pkgs.repoforge.org/dnsmasq/dnsmasq-#{node['openstack']['network']['dhcp']['dnsmasq_rpm_version']}.rpm"
default['openstack']['network']['dhcp']['dnsmasq_rpm_version'] = '2.65-1.el6.rfx.x86_64'
default['openstack']['network']['dhcp']['dnsmasq_rpm_source'] = "http://pkgs.repoforge.org/dnsmasq/dnsmasq-#{node['openstack']['network']['dhcp']['dnsmasq_rpm_version']}.rpm"
# The package architecture that will be built which should match the
# archecture of the server this cookbook will run on which will be

View File

@@ -74,13 +74,14 @@ when 'centos'
remote_file dnsmasq_file do
source node['openstack']['network']['dhcp']['dnsmasq_rpm_source']
not_if { ::File.exists?(dnsmasq_file) }
not_if { ::File.exists?(dnsmasq_file) || node['openstack']['network']['dhcp']['dnsmasq_rpm_version'].to_s.empty? }
end
rpm_package 'dnsmasq' do
source dnsmasq_file
action :install
notifies :restart, 'service[neutron-dhcp-agent]', :immediately
not_if { node['openstack']['network']['dhcp']['dnsmasq_rpm_version'].to_s.empty? }
end
end
end

View File

@@ -8,7 +8,6 @@ describe 'openstack-network::dhcp_agent' do
let(:node) { runner.node }
let(:chef_run) do
node.set['openstack']['compute']['network']['service_type'] = 'neutron'
node.set['openstack']['compute']['network']['dhcp']['dnsmasq_rpm_source'] = 'http://pkgs.repoforge.org/dnsmasq/dnsmasq-2.65-1.el6.rfx.x86_64.rpm'
runner.converge(described_recipe)
end
@@ -36,7 +35,7 @@ describe 'openstack-network::dhcp_agent' do
end
it 'should have the correct dnsmasq remote file' do
expect(chef_run).to create_remote_file("#{Chef::Config[:file_cache_path]}/2.65-1.el6.rfx.x86_64").with(source: 'http://pkgs.repoforge.org/dnsmasq/dnsmasq-.rpm')
expect(chef_run).to create_remote_file("#{Chef::Config[:file_cache_path]}/2.65-1.el6.rfx.x86_64").with(source: 'http://pkgs.repoforge.org/dnsmasq/dnsmasq-2.65-1.el6.rfx.x86_64.rpm')
end
it 'should install the corrcet dnsmasq rpm' do
@@ -47,6 +46,11 @@ describe 'openstack-network::dhcp_agent' do
expect(chef_run.rpm_package('dnsmasq')).to notify('service[neutron-dhcp-agent]').to(:restart).immediately
end
it 'should not have the correct dnsmasq remote file when no version' do
node.set['openstack']['network']['dhcp']['dnsmasq_rpm_version'] = ''
expect(chef_run).not_to create_remote_file("#{Chef::Config[:file_cache_path]}/2.65-1.el6.rfx.x86_64")
end
describe '/etc/neutron/dhcp_agent.ini' do
let(:file) { chef_run.template('/etc/neutron/dhcp_agent.ini') }