Use oslo module for logging and policy configuration

Change-Id: If08a0bc9d4941aa97aedb28d1338603164490f70
This commit is contained in:
ZhongShengping
2016-05-07 11:05:35 +08:00
parent b44afcb6cb
commit aa9c18a177
4 changed files with 25 additions and 23 deletions

View File

@@ -119,29 +119,24 @@ class gnocchi::logging(
$verbose_real = pick($::gnocchi::verbose,$verbose)
$debug_real = pick($::gnocchi::debug,$debug)
if is_service_default($default_log_levels) {
$default_log_levels_real = $default_log_levels
} else {
$default_log_levels_real = join(sort(join_keys_to_values($default_log_levels, '=')), ',')
oslo::log { 'gnocchi_config':
debug => $debug_real,
verbose => $verbose_real,
use_syslog => $use_syslog_real,
use_stderr => $use_stderr_real,
log_dir => $log_dir_real,
syslog_log_facility => $log_facility_real,
logging_context_format_string => $logging_context_format_string,
logging_default_format_string => $logging_default_format_string,
logging_debug_format_suffix => $logging_debug_format_suffix,
logging_exception_prefix => $logging_exception_prefix,
log_config_append => $log_config_append,
default_log_levels => $default_log_levels,
publish_errors => $publish_errors,
fatal_deprecations => $fatal_deprecations,
instance_format => $instance_format,
instance_uuid_format => $instance_uuid_format,
log_date_format => $log_date_format,
}
gnocchi_config {
'DEFAULT/debug' : value => $debug_real;
'DEFAULT/verbose' : value => $verbose_real;
'DEFAULT/use_stderr' : value => $use_stderr_real;
'DEFAULT/use_syslog' : value => $use_syslog_real;
'DEFAULT/log_dir' : value => $log_dir_real;
'DEFAULT/syslog_log_facility' : value => $log_facility_real;
'DEFAULT/logging_context_format_string' : value => $logging_context_format_string;
'DEFAULT/logging_default_format_string' : value => $logging_default_format_string;
'DEFAULT/logging_debug_format_suffix' : value => $logging_debug_format_suffix;
'DEFAULT/logging_exception_prefix' : value => $logging_exception_prefix;
'DEFAULT/log_config_append' : value => $log_config_append;
'DEFAULT/default_log_levels' : value => $default_log_levels_real;
'DEFAULT/publish_errors' : value => $publish_errors;
'DEFAULT/fatal_deprecations' : value => $fatal_deprecations;
'DEFAULT/instance_format' : value => $instance_format;
'DEFAULT/instance_uuid_format' : value => $instance_uuid_format;
'DEFAULT/log_date_format' : value => $log_date_format;
}
}

View File

@@ -36,4 +36,6 @@ class gnocchi::policy (
create_resources('openstacklib::policy::base', $policies)
oslo::policy { 'gnocchi_config': policy_file => $policy_path }
}

View File

@@ -0,0 +1,4 @@
---
features:
- Switch to puppet-oslo resource usage (instead of
manual configuration file editing).

View File

@@ -20,6 +20,7 @@ describe 'gnocchi::policy' do
:key => 'context_is_admin',
:value => 'foo:bar'
})
is_expected.to contain_gnocchi_config('oslo_policy/policy_file').with_value('/etc/gnocchi/policy.json')
end
end