Manage aodh-expirer package by aodh::expirer class
Since aodh-expirer command is included in a different package, we need to manage that package as well in the corresponding class. Change-Id: Ie3111d5a168e8d15f3e04d410a5a5c30b44324c2
This commit is contained in:
parent
4620cd4dd1
commit
007d3a82f6
@ -9,6 +9,10 @@
|
||||
# (optional) The state of cron job.
|
||||
# Defaults to present.
|
||||
#
|
||||
# [*package_ensure*]
|
||||
# (optional) ensure state for package.
|
||||
# Defaults to 'present'
|
||||
#
|
||||
# [*minute*]
|
||||
# (optional) Defaults to '1'.
|
||||
#
|
||||
@ -32,6 +36,7 @@
|
||||
#
|
||||
class aodh::expirer (
|
||||
$ensure = 'present',
|
||||
$package_ensure = 'present',
|
||||
$minute = 1,
|
||||
$hour = 0,
|
||||
$monthday = '*',
|
||||
@ -43,6 +48,11 @@ class aodh::expirer (
|
||||
include aodh::params
|
||||
include aodh::deps
|
||||
|
||||
ensure_resource( 'package', [$::aodh::params::expirer_package_name],
|
||||
{ ensure => $package_ensure,
|
||||
tag => ['openstack', 'aodh-package'] }
|
||||
)
|
||||
|
||||
if $maxdelay == 0 {
|
||||
$sleep = ''
|
||||
} else {
|
||||
|
5
releasenotes/notes/expirer-package-a318c98f11722956.yaml
Normal file
5
releasenotes/notes/expirer-package-a318c98f11722956.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
Now the ``aodh::expirer`` class installs aodh-expire package automatically.
|
||||
The status of package can be defined by the ``package_ensure`` parameter.
|
@ -10,6 +10,13 @@ describe 'aodh::expirer' do
|
||||
it { is_expected.to contain_class('aodh::deps') }
|
||||
it { is_expected.to contain_class('aodh::params') }
|
||||
|
||||
it 'installs aodh-expirer package' do
|
||||
is_expected.to contain_package(platform_params[:expirer_package_name]).with(
|
||||
:ensure => 'present',
|
||||
:tag => ['openstack', 'aodh-package']
|
||||
)
|
||||
end
|
||||
|
||||
it { is_expected.to contain_cron('aodh-expirer').with(
|
||||
:ensure => 'present',
|
||||
:command => 'aodh-expirer',
|
||||
@ -35,6 +42,13 @@ describe 'aodh::expirer' do
|
||||
it { is_expected.to contain_class('aodh::deps') }
|
||||
it { is_expected.to contain_class('aodh::params') }
|
||||
|
||||
it 'installs aodh-expirer package' do
|
||||
is_expected.to contain_package(platform_params[:expirer_package_name]).with(
|
||||
:ensure => 'present',
|
||||
:tag => ['openstack', 'aodh-package']
|
||||
)
|
||||
end
|
||||
|
||||
it { is_expected.to contain_cron('aodh-expirer').with(
|
||||
:ensure => 'absent',
|
||||
:command => 'sleep `expr ${RANDOM} \\% 300`; aodh-expirer',
|
||||
@ -59,6 +73,14 @@ describe 'aodh::expirer' do
|
||||
facts.merge!(OSDefaults.get_facts())
|
||||
end
|
||||
|
||||
let(:platform_params) do
|
||||
case facts[:osfamily]
|
||||
when 'Debian'
|
||||
{ :expirer_package_name => 'aodh-expirer' }
|
||||
when 'RedHat'
|
||||
{ :expirer_package_name => 'openstack-aodh-expirer' }
|
||||
end
|
||||
end
|
||||
it_behaves_like 'aodh::expirer'
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user