Merge "polling: Ensure unused parameters are cleared"
This commit is contained in:
commit
a569c41855
|
@ -103,7 +103,7 @@ class ceilometer::agent::polling (
|
|||
if $central_namespace {
|
||||
$central_namespace_name = 'central'
|
||||
} else {
|
||||
$central_namespace_name = ''
|
||||
$central_namespace_name = undef
|
||||
}
|
||||
|
||||
if $compute_namespace {
|
||||
|
@ -129,27 +129,39 @@ class ceilometer::agent::polling (
|
|||
'compute/resource_cache_expiry': value => $resource_cache_expiry;
|
||||
}
|
||||
} else {
|
||||
$compute_namespace_name = ''
|
||||
$compute_namespace_name = undef
|
||||
ceilometer_config {
|
||||
'compute/instance_discovery_method': ensure => absent;
|
||||
'compute/resource_update_interval': ensure => absent;
|
||||
'compute/resource_cache_expiry': ensure => absent;
|
||||
}
|
||||
}
|
||||
|
||||
if $ipmi_namespace {
|
||||
$ipmi_namespace_name = 'ipmi'
|
||||
} else {
|
||||
$ipmi_namespace_name = ''
|
||||
$ipmi_namespace_name = undef
|
||||
}
|
||||
|
||||
$namespaces = delete([$central_namespace_name, $compute_namespace_name, $ipmi_namespace_name], '')
|
||||
$namespaces_real = inline_template('<%= @namespaces.select { |x| x and x !~ /^undef/ }.compact.join "," %>')
|
||||
|
||||
package { 'ceilometer-polling':
|
||||
ensure => $package_ensure,
|
||||
name => $::ceilometer::params::agent_polling_package_name,
|
||||
tag => ['openstack', 'ceilometer-package'],
|
||||
}
|
||||
|
||||
if $namespaces_real {
|
||||
$namespaces_real = delete_undef_values([
|
||||
$central_namespace_name,
|
||||
$compute_namespace_name,
|
||||
$ipmi_namespace_name
|
||||
])
|
||||
|
||||
if empty($namespaces_real) {
|
||||
ceilometer_config {
|
||||
'DEFAULT/polling_namespaces': value => $namespaces_real
|
||||
'DEFAULT/polling_namespaces': ensure => absent
|
||||
}
|
||||
} else {
|
||||
ceilometer_config {
|
||||
'DEFAULT/polling_namespaces': value => join($namespaces_real, ',')
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -82,15 +82,44 @@ describe 'ceilometer::agent::polling' do
|
|||
}
|
||||
end
|
||||
|
||||
context 'with compute namespace disabled' do
|
||||
before do
|
||||
params.merge!(
|
||||
:compute_namespace => false
|
||||
)
|
||||
end
|
||||
|
||||
it {
|
||||
should contain_ceilometer_config('DEFAULT/polling_namespaces').with_value('central,ipmi')
|
||||
should contain_ceilometer_config('compute/instance_discovery_method').with_ensure('absent')
|
||||
should contain_ceilometer_config('compute/resource_update_interval').with_ensure('absent')
|
||||
should contain_ceilometer_config('compute/resource_cache_expiry').with_ensure('absent')
|
||||
}
|
||||
end
|
||||
|
||||
context 'with central and ipmi polling namespaces disabled' do
|
||||
before do
|
||||
params.merge!( :central_namespace => false,
|
||||
:ipmi_namespace => false )
|
||||
params.merge!(
|
||||
:central_namespace => false,
|
||||
:ipmi_namespace => false
|
||||
)
|
||||
end
|
||||
|
||||
it { should contain_ceilometer_config('DEFAULT/polling_namespaces').with_value('compute') }
|
||||
end
|
||||
|
||||
context 'with all namespaces disabled' do
|
||||
before do
|
||||
params.merge!(
|
||||
:compute_namespace => false,
|
||||
:central_namespace => false,
|
||||
:ipmi_namespace => false
|
||||
)
|
||||
end
|
||||
|
||||
it { should contain_ceilometer_config('DEFAULT/polling_namespaces').with_ensure('absent') }
|
||||
end
|
||||
|
||||
context 'with service disabled' do
|
||||
before do
|
||||
params.merge!( :enabled => false )
|
||||
|
|
Loading…
Reference in New Issue