Add atop configuration settings
Now the atop setting are configurable from UI and can be overriden in hiera. Also, this change adds idempotency and fix noop tests. DocImpact Depends-On: Ie0e69f58183193455d5d036b45668a3476f1a693 Change-Id: I59cea9ea5ca31c20db2cf3eaaebe09bad0abdcf8 Closes-Bug: #1597250 Signed-off-by: Maksim Malchuk <mmalchuk@mirantis.com>
This commit is contained in:
parent
b6e68ee0c0
commit
a7f03d7c55
|
@ -28,7 +28,7 @@
|
|||
#
|
||||
class osnailyfacter::atop (
|
||||
$service_enabled = true,
|
||||
$service_state = 'running',
|
||||
$service_state = $service_enabled ? { false => 'stopped', default => 'running' },
|
||||
$interval = '20',
|
||||
$logpath = '/var/log/atop',
|
||||
$rotate = '7',
|
||||
|
@ -50,6 +50,7 @@ class osnailyfacter::atop (
|
|||
}
|
||||
|
||||
$atop_retention = '/etc/cron.daily/atop_retention'
|
||||
$atop_retention_ensure = $service_enabled ? { false => 'absent', default => 'file' }
|
||||
|
||||
File {
|
||||
ensure => file,
|
||||
|
@ -102,13 +103,17 @@ class osnailyfacter::atop (
|
|||
# - $rotate
|
||||
# - $logpath
|
||||
file { $atop_retention:
|
||||
ensure => $atop_retention_ensure,
|
||||
mode => '0755',
|
||||
content => template('osnailyfacter/atop_retention.erb'),
|
||||
} ~>
|
||||
}
|
||||
|
||||
exec { 'initialize atop_current':
|
||||
command => $atop_retention,
|
||||
refreshonly => true,
|
||||
if $service_enabled {
|
||||
exec { 'initialize atop_current':
|
||||
command => $atop_retention,
|
||||
refreshonly => true,
|
||||
subscribe => File[$atop_retention],
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,11 +2,20 @@ class osnailyfacter::tools::tools {
|
|||
|
||||
notice('MODULAR: tools/tools.pp')
|
||||
|
||||
$atop_hash = hiera('atop', {})
|
||||
$atop_enabled = pick($atop_hash['service_enabled'], true)
|
||||
$atop_interval = pick($atop_hash['interval'], 20)
|
||||
$atop_rotate = pick($atop_hash['rotate'], 7)
|
||||
|
||||
$custom_acct_file = hiera('custom_accounting_file', undef)
|
||||
|
||||
$puppet = hiera('puppet')
|
||||
$deployment_mode = hiera('deployment_mode')
|
||||
|
||||
class { '::osnailyfacter::atop':
|
||||
service_enabled => $atop_enabled,
|
||||
interval => $atop_interval,
|
||||
rotate => $atop_rotate,
|
||||
custom_acct_file => $custom_acct_file,
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,11 @@ cloud_init_services = [
|
|||
'cloud-log-shutdown',
|
||||
]
|
||||
|
||||
atop_hash = Noop.hiera 'atop', {}
|
||||
atop_enabled = Noop.puppet_function 'pick', atop_hash['service_enabled'], true
|
||||
atop_interval = Noop.puppet_function 'pick', atop_hash['interval'], 20
|
||||
atop_rotate = Noop.puppet_function 'pick', atop_hash['rotate'], 7
|
||||
|
||||
puppet = Noop.hiera('puppet')
|
||||
|
||||
describe manifest do
|
||||
|
@ -49,7 +54,11 @@ describe manifest do
|
|||
end
|
||||
|
||||
it 'should declare tools classes' do
|
||||
should contain_class('osnailyfacter::atop')
|
||||
should contain_class('osnailyfacter::atop').with(
|
||||
'service_enabled' => atop_enabled,
|
||||
'interval' => atop_interval,
|
||||
'rotate' => atop_rotate,
|
||||
)
|
||||
should contain_class('osnailyfacter::ssh').with(
|
||||
'accept_env' => 'LANG LC_*',
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue