Add optional installation of oslo.reports package
Some services like ironic does not require oslo.reports but users have to install the library to capture GMR. This introduces a few new options to enable management of oslo.reports package to cover that requirement. Because the oslo::reports class was added during this cycle, this change contains no release note updates. Change-Id: I64d9e6e8135fa051db0a3a576ee8998fd00a3824
This commit is contained in:
@@ -14,6 +14,7 @@ class oslo::params {
|
|||||||
$python_redis_package_name = 'python3-redis'
|
$python_redis_package_name = 'python3-redis'
|
||||||
$python_etcd3gw_package_name = 'python3-etcd3gw'
|
$python_etcd3gw_package_name = 'python3-etcd3gw'
|
||||||
$python_pymemcache_package_name = 'python3-pymemcache'
|
$python_pymemcache_package_name = 'python3-pymemcache'
|
||||||
|
$oslo_reports_package_name = 'python3-oslo-reports'
|
||||||
}
|
}
|
||||||
'Debian': {
|
'Debian': {
|
||||||
$pymysql_package_name = 'python3-pymysql'
|
$pymysql_package_name = 'python3-pymysql'
|
||||||
@@ -21,6 +22,7 @@ class oslo::params {
|
|||||||
$python_redis_package_name = 'python3-redis'
|
$python_redis_package_name = 'python3-redis'
|
||||||
$python_etcd3gw_package_name = 'python3-etcd3gw'
|
$python_etcd3gw_package_name = 'python3-etcd3gw'
|
||||||
$python_pymemcache_package_name = 'python3-pymemcache'
|
$python_pymemcache_package_name = 'python3-pymemcache'
|
||||||
|
$oslo_reports_package_name = 'python3-oslo.reports'
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
fail("Unsupported osfamily: ${facts['os']['family']}")
|
fail("Unsupported osfamily: ${facts['os']['family']}")
|
||||||
|
@@ -21,18 +21,38 @@
|
|||||||
# is set.
|
# is set.
|
||||||
# Defaults to $facts['os_service_default']
|
# Defaults to $facts['os_service_default']
|
||||||
#
|
#
|
||||||
|
# [*package_ensure*]
|
||||||
|
# (Optional) ensure state for package.
|
||||||
|
# Defaults to 'present'
|
||||||
|
#
|
||||||
|
# [*manage_package*]
|
||||||
|
# (Optional) Manage oslo.reports package.
|
||||||
|
# Defaults to false
|
||||||
|
#
|
||||||
define oslo::reports(
|
define oslo::reports(
|
||||||
$config = $name,
|
$config = $name,
|
||||||
$log_dir = $facts['os_service_default'],
|
$log_dir = $facts['os_service_default'],
|
||||||
$file_event_handler = $facts['os_service_default'],
|
$file_event_handler = $facts['os_service_default'],
|
||||||
$file_event_handler_interval = $facts['os_service_default'],
|
$file_event_handler_interval = $facts['os_service_default'],
|
||||||
|
$package_ensure = 'present',
|
||||||
|
Boolean $manage_package = false,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
include oslo::params
|
||||||
|
|
||||||
$oslo_reports_options = {
|
$oslo_reports_options = {
|
||||||
'oslo_reports/log_dir' => { value => $log_dir },
|
'oslo_reports/log_dir' => { value => $log_dir },
|
||||||
'oslo_reports/file_event_handler' => { value => $file_event_handler },
|
'oslo_reports/file_event_handler' => { value => $file_event_handler },
|
||||||
'oslo_reports/file_event_handler_interval' => { value => $file_event_handler_interval },
|
'oslo_reports/file_event_handler_interval' => { value => $file_event_handler_interval },
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if $manage_package {
|
||||||
|
ensure_packages( 'oslo.reports', {
|
||||||
|
name => $::oslo::params::oslo_reports_package_name,
|
||||||
|
ensure => $package_ensure,
|
||||||
|
tag => ['openstack'],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
create_resources($config, $oslo_reports_options)
|
create_resources($config, $oslo_reports_options)
|
||||||
}
|
}
|
||||||
|
@@ -16,6 +16,10 @@ describe 'oslo::reports' do
|
|||||||
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').with_value('<SERVICE DEFAULT>')
|
||||||
is_expected.to contain_keystone_config('oslo_reports/file_event_handler_interval').with_value('<SERVICE DEFAULT>')
|
is_expected.to contain_keystone_config('oslo_reports/file_event_handler_interval').with_value('<SERVICE DEFAULT>')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'should not manage the oslo.reports package' do
|
||||||
|
is_expected.to_not contain_package('oslo.reports')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with parameters overridden' do
|
context 'with parameters overridden' do
|
||||||
@@ -33,6 +37,20 @@ describe 'oslo::reports' do
|
|||||||
is_expected.to contain_keystone_config('oslo_reports/file_event_handler_interval').with_value(1)
|
is_expected.to contain_keystone_config('oslo_reports/file_event_handler_interval').with_value(1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'with package management enabled' do
|
||||||
|
let :params do
|
||||||
|
{ :manage_package => true }
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should not manage the oslo.reports package' do
|
||||||
|
is_expected.to contain_package('oslo.reports').with(
|
||||||
|
:ensure => 'installed',
|
||||||
|
:name => platform_params[:oslo_reports_package_name],
|
||||||
|
:tag => ['openstack'],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
on_supported_os({
|
on_supported_os({
|
||||||
@@ -43,6 +61,15 @@ describe 'oslo::reports' do
|
|||||||
facts.merge!(OSDefaults.get_facts())
|
facts.merge!(OSDefaults.get_facts())
|
||||||
end
|
end
|
||||||
|
|
||||||
|
let(:platform_params) do
|
||||||
|
case facts[:os]['family']
|
||||||
|
when 'Debian'
|
||||||
|
{ :oslo_reports_package_name => 'python3-oslo.reports' }
|
||||||
|
when 'RedHat'
|
||||||
|
{ :oslo_reports_package_name => 'python3-oslo-reports' }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
include_examples 'oslo::reports'
|
include_examples 'oslo::reports'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user