Add parameter to configure metrics.yml file
Remark: a similar approach with the to_yaml function is implemented in puppet-ceilometer Change-Id: Icc8f217506c3a1e517a685b633e8c86f35960136
This commit is contained in:
@@ -35,6 +35,11 @@ class cloudkitty::deps {
|
||||
-> Openstacklib::Policy::Base<||>
|
||||
~> Anchor['cloudkitty::config::end']
|
||||
|
||||
# Ensure files are modified in the config block
|
||||
Anchor['cloudkitty::config::begin']
|
||||
-> File<| tag == 'cloudkitty-yamls' |>
|
||||
~> Anchor['cloudkitty::config::end']
|
||||
|
||||
# Installation or config changes will always restart services.
|
||||
Anchor['cloudkitty::install::end'] ~> Anchor['cloudkitty::service::begin']
|
||||
Anchor['cloudkitty::config::end'] ~> Anchor['cloudkitty::service::begin']
|
||||
|
@@ -252,6 +252,10 @@
|
||||
# (Optional) Keystone version to use.
|
||||
# Defaults to '3'
|
||||
#
|
||||
# [*metrics_config*]
|
||||
# (Optional) A hash of the metrics.yaml configuration.
|
||||
# Defaults to undef
|
||||
#
|
||||
# DEPRECATED PARAMETERS
|
||||
#
|
||||
# [*tenant_fetcher_backend*]
|
||||
@@ -310,6 +314,7 @@ class cloudkitty(
|
||||
$fetcher_backend = $::os_service_default,
|
||||
$auth_section = 'keystone_authtoken',
|
||||
$keystone_version = '3',
|
||||
Optional[Hash] $metrics_config = undef,
|
||||
# DEPRECATED PARAMETERS
|
||||
$tenant_fetcher_backend = undef,
|
||||
) {
|
||||
@@ -408,4 +413,16 @@ class cloudkitty(
|
||||
'fetcher_keystone/keystone_version': value => $keystone_version;
|
||||
}
|
||||
|
||||
if $metrics_config {
|
||||
file {'metrics.yml':
|
||||
ensure => present,
|
||||
path => $::cloudkitty::params::metrics_yaml,
|
||||
content => to_yaml($metrics_config),
|
||||
selinux_ignore_defaults => true,
|
||||
mode => '0640',
|
||||
owner => 'root',
|
||||
group => $::cloudkitty::params::group,
|
||||
tag => 'cloudkitty-yamls',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -10,6 +10,7 @@ class cloudkitty::params {
|
||||
$api_service_name = 'cloudkitty-api'
|
||||
$processor_service_name = 'cloudkitty-processor'
|
||||
$group = 'cloudkitty'
|
||||
$metrics_yaml = '/etc/cloudkitty/metrics.yml'
|
||||
|
||||
case $::osfamily {
|
||||
'RedHat': {
|
||||
|
@@ -0,0 +1,5 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
add new parameter $cloudkitty::metrics_config to configure the content of
|
||||
/etc/metrics.yml file wich defines the values to catch.
|
@@ -196,6 +196,24 @@ describe 'cloudkitty' do
|
||||
is_expected.to contain_cloudkitty_config('oslo_messaging_amqp/password').with_value('password')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with metrics_donfig' do
|
||||
let :params do
|
||||
{ :metrics_config => {'metrics' => {}},
|
||||
}
|
||||
end
|
||||
|
||||
it 'configures metrics.yml' do
|
||||
is_expected.to contain_file('metrics.yml')
|
||||
.with_ensure('present')
|
||||
.with_path('/etc/cloudkitty/metrics.yml')
|
||||
.with_selinux_ignore_defaults(TRUE)
|
||||
.with_mode('0640')
|
||||
.with_owner('root')
|
||||
.with_group('cloudkitty')
|
||||
.with_tag('cloudkitty-yamls')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
|
Reference in New Issue
Block a user