Add support for oslo.reports library options
This change adds support for options of the olso.reports library, which is used in several components to generate Guru Meditation Reports(GMR). Change-Id: I2db5a2639ea98ed983a9d07e6cef1f493c6ae6b5
This commit is contained in:

committed by
Takashi Kajinami

parent
97ee84e76f
commit
1efa397d12
38
manifests/reports.pp
Normal file
38
manifests/reports.pp
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
# == Define: oslo::reports
|
||||||
|
#
|
||||||
|
# Configure oslo_reports options
|
||||||
|
#
|
||||||
|
# === Parameters
|
||||||
|
#
|
||||||
|
# [*config*]
|
||||||
|
# (Optional) The resource type used to apply configuration parameters.
|
||||||
|
# Defaults to $name
|
||||||
|
#
|
||||||
|
# [*log_dir*]
|
||||||
|
# (Optional) Path to a log directory where to create a file
|
||||||
|
# Defaults to $facts['os_service_default']
|
||||||
|
#
|
||||||
|
# [*file_event_handler*]
|
||||||
|
# (Optional) The path to a file to watch for changes to trigger the reports.
|
||||||
|
# Defaults to $facts['os_service_default']
|
||||||
|
#
|
||||||
|
# [*file_event_handler_interval*]
|
||||||
|
# (Optional) How many seconds to wait between pools when file_event_handler
|
||||||
|
# is set.
|
||||||
|
# Defaults to $facts['os_service_default']
|
||||||
|
#
|
||||||
|
define oslo::reports(
|
||||||
|
$config = $name,
|
||||||
|
$log_dir = $facts['os_service_default'],
|
||||||
|
$file_event_handler = $facts['os_service_default'],
|
||||||
|
$file_event_handler_interval = $facts['os_service_default'],
|
||||||
|
) {
|
||||||
|
|
||||||
|
$oslo_reports_options = {
|
||||||
|
'oslo_reports/log_dir' => { value => $log_dir },
|
||||||
|
'oslo_reports/file_event_handler' => { value => $file_event_handler },
|
||||||
|
'oslo_reports/file_event_handler_interval' => { value => $file_event_handler_interval },
|
||||||
|
}
|
||||||
|
|
||||||
|
create_resources($config, $oslo_reports_options)
|
||||||
|
}
|
4
releasenotes/notes/oslo_reports-12002edb359451c8.yaml
Normal file
4
releasenotes/notes/oslo_reports-12002edb359451c8.yaml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Support for parameters of the oslo.reports library has been added.
|
49
spec/defines/oslo_reports_spec.rb
Normal file
49
spec/defines/oslo_reports_spec.rb
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe 'oslo::reports' do
|
||||||
|
|
||||||
|
let (:title) { 'keystone_config' }
|
||||||
|
|
||||||
|
shared_examples 'oslo::reports' do
|
||||||
|
|
||||||
|
context 'with default parameters' do
|
||||||
|
let :params do
|
||||||
|
{}
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'configure reports default params' do
|
||||||
|
is_expected.to contain_keystone_config('oslo_reports/log_dir').with_value('<SERVICE DEFAULT>')
|
||||||
|
is_expected.to contain_keystone_config('oslo_reports/file_event_handler').with_value('<SERVICE DEFAULT>')
|
||||||
|
is_expected.to contain_keystone_config('oslo_reports/file_event_handler_interval').with_value('<SERVICE DEFAULT>')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with parameters overridden' do
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:log_dir => '/var/log/keystone',
|
||||||
|
:file_event_handler => '/var/tmp/keystone/reports',
|
||||||
|
:file_event_handler_interval => 1,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'configure oslo_reports params' do
|
||||||
|
is_expected.to contain_keystone_config('oslo_reports/log_dir').with_value('/var/log/keystone')
|
||||||
|
is_expected.to contain_keystone_config('oslo_reports/file_event_handler').with_value('/var/tmp/keystone/reports')
|
||||||
|
is_expected.to contain_keystone_config('oslo_reports/file_event_handler_interval').with_value(1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
on_supported_os({
|
||||||
|
:supported_os => OSDefaults.get_supported_os
|
||||||
|
}).each do |os,facts|
|
||||||
|
context "on #{os}" do
|
||||||
|
let (:facts) do
|
||||||
|
facts.merge!(OSDefaults.get_facts())
|
||||||
|
end
|
||||||
|
|
||||||
|
include_examples 'oslo::reports'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Reference in New Issue
Block a user