Use ensure_packages with dnsmasq package resource
Use ensure_packages with the dnsmasq package resource to allow coexistance with other modules which define the same resource name (puppet-cobbler, for example). Change-Id: Id4cb8b4fdf291f3a62682ab5655ac4eaf2a5370b
This commit is contained in:

committed by
Michael Chapman

parent
2a2d76ad85
commit
2ccd0b77eb
@@ -57,11 +57,8 @@ class neutron::agents::dhcp (
|
|||||||
|
|
||||||
case $dhcp_driver {
|
case $dhcp_driver {
|
||||||
/\.Dnsmasq/: {
|
/\.Dnsmasq/: {
|
||||||
Package['dnsmasq'] -> Package<| title == 'neutron-dhcp-agent' |>
|
Package[$::neutron::params::dnsmasq_packages] -> Package<| title == 'neutron-dhcp-agent' |>
|
||||||
ensure_resource('package', 'dnsmasq', {
|
ensure_packages($::neutron::params::dnsmasq_packages)
|
||||||
ensure => present,
|
|
||||||
name => $::neutron::params::dnsmasq_packages,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
fail("Unsupported dhcp_driver ${dhcp_driver}")
|
fail("Unsupported dhcp_driver ${dhcp_driver}")
|
||||||
|
@@ -69,11 +69,16 @@ describe 'neutron::agents::dhcp' do
|
|||||||
shared_examples_for 'dnsmasq dhcp_driver' do
|
shared_examples_for 'dnsmasq dhcp_driver' do
|
||||||
it 'installs dnsmasq packages' do
|
it 'installs dnsmasq packages' do
|
||||||
if platform_params.has_key?(:dhcp_agent_package)
|
if platform_params.has_key?(:dhcp_agent_package)
|
||||||
should contain_package('dnsmasq').with_before('Package[neutron-dhcp-agent]')
|
should contain_package(platform_params[:dnsmasq_base_package]).with_before('Package[neutron-dhcp-agent]')
|
||||||
|
should contain_package(platform_params[:dnsmasq_utils_package]).with_before('Package[neutron-dhcp-agent]')
|
||||||
end
|
end
|
||||||
should contain_package('dnsmasq').with(
|
should contain_package(platform_params[:dnsmasq_base_package]).with(
|
||||||
:ensure => 'present',
|
:ensure => 'present',
|
||||||
:name => platform_params[:dnsmasq_packages]
|
:name => platform_params[:dnsmasq_base_package]
|
||||||
|
)
|
||||||
|
should contain_package(platform_params[:dnsmasq_utils_package]).with(
|
||||||
|
:ensure => 'present',
|
||||||
|
:name => platform_params[:dnsmasq_utils_package]
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -85,7 +90,8 @@ describe 'neutron::agents::dhcp' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
let :platform_params do
|
let :platform_params do
|
||||||
{ :dnsmasq_packages => ['dnsmasq-base', 'dnsmasq-utils'],
|
{ :dnsmasq_base_package => 'dnsmasq-base',
|
||||||
|
:dnsmasq_utils_package => 'dnsmasq-utils',
|
||||||
:dhcp_agent_package => 'neutron-dhcp-agent',
|
:dhcp_agent_package => 'neutron-dhcp-agent',
|
||||||
:dhcp_agent_service => 'neutron-dhcp-agent' }
|
:dhcp_agent_service => 'neutron-dhcp-agent' }
|
||||||
end
|
end
|
||||||
@@ -99,7 +105,8 @@ describe 'neutron::agents::dhcp' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
let :platform_params do
|
let :platform_params do
|
||||||
{ :dnsmasq_packages => ['dnsmasq', 'dnsmasq-utils'],
|
{ :dnsmasq_base_package => 'dnsmasq',
|
||||||
|
:dnsmasq_utils_package => 'dnsmasq-utils',
|
||||||
:dhcp_agent_service => 'neutron-dhcp-agent' }
|
:dhcp_agent_service => 'neutron-dhcp-agent' }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user