summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPradeep Kilambi <pkilambi@redhat.com>2017-06-07 14:35:16 -0400
committerPradeep Kilambi <pkilambi@redhat.com>2017-06-15 14:51:53 +0000
commit48ab267d686a9ec5e364df3b8c368fa628afe0b8 (patch)
tree21e02b6e83386aa50683712dccfbd7a2723e3c36
parent48f6acd3a50d2e5e1622f48a89e60d74ae44a29c (diff)
Deprecate logging options
Gnocchi is moving away from oslo.log to using daiquiri[1] Lets deprecate the options that dont make sense anymore. [1] http://github.com/jd/daiquiri Change-Id: I0b8e324f40ac35f2f7f7f1234b8183eb40a8a64d
Notes
Notes (review): Code-Review+2: Alex Schultz <aschultz@redhat.com> Workflow+1: Emilien Macchi <emilien@redhat.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Fri, 16 Jun 2017 17:34:38 +0000 Reviewed-on: https://review.openstack.org/471884 Project: openstack/puppet-gnocchi Branch: refs/heads/master
-rw-r--r--manifests/logging.pp68
-rw-r--r--releasenotes/notes/deprecate-oslo-log-params-12ed30a5db0e5baf.yaml4
-rw-r--r--spec/classes/gnocchi_logging_spec.rb56
3 files changed, 56 insertions, 72 deletions
diff --git a/manifests/logging.pp b/manifests/logging.pp
index 26228fb..c192c9c 100644
--- a/manifests/logging.pp
+++ b/manifests/logging.pp
@@ -26,6 +26,8 @@
26# any directory. 26# any directory.
27# Defaults to '/var/log/gnocchi' 27# Defaults to '/var/log/gnocchi'
28# 28#
29# DEPRECATED PARAMETERS
30#
29# [*logging_context_format_string*] 31# [*logging_context_format_string*]
30# (optional) format string to use for log messages with context. 32# (optional) format string to use for log messages with context.
31# Defaults to $::os_service_default 33# Defaults to $::os_service_default
@@ -92,6 +94,7 @@ class gnocchi::logging(
92 $log_facility = $::os_service_default, 94 $log_facility = $::os_service_default,
93 $log_dir = '/var/log/gnocchi', 95 $log_dir = '/var/log/gnocchi',
94 $debug = $::os_service_default, 96 $debug = $::os_service_default,
97 # DEPRECATED
95 $logging_context_format_string = $::os_service_default, 98 $logging_context_format_string = $::os_service_default,
96 $logging_default_format_string = $::os_service_default, 99 $logging_default_format_string = $::os_service_default,
97 $logging_debug_format_suffix = $::os_service_default, 100 $logging_debug_format_suffix = $::os_service_default,
@@ -107,6 +110,50 @@ class gnocchi::logging(
107 110
108 include ::gnocchi::deps 111 include ::gnocchi::deps
109 112
113 if $logging_context_format_string {
114 warning('gnocchi::logging::logging_context_format_string is deprecated and will be removed in future')
115 }
116
117 if $logging_default_format_string {
118 warning('gnocchi::logging::logging_default_format_string is deprecated and will be removed in future')
119 }
120
121 if $logging_debug_format_suffix {
122 warning('gnocchi::logging::logging_debug_format_suffix is deprecated and will be removed in future')
123 }
124
125 if $logging_exception_prefix {
126 warning('gnocchi::logging::logging_exception_prefix is deprecated and will be removed in future')
127 }
128
129 if $log_config_append {
130 warning('gnocchi::logging::log_config_append is deprecated and will be removed in future')
131 }
132
133 if $default_log_levels {
134 warning('gnocchi::logging::default_log_levels is deprecated and will be removed in future')
135 }
136
137 if $publish_errors {
138 warning('gnocchi::logging::publish_errors is deprecated and will be removed in future')
139 }
140
141 if $fatal_deprecations {
142 warning('gnocchi::logging::fatal_deprecations is deprecated and will be removed in future')
143 }
144
145 if $instance_format {
146 warning('gnocchi::logging::instance_format is deprecated and will be removed in future')
147 }
148
149 if $instance_uuid_format {
150 warning('gnocchi::logging::instance_uuid_format is deprecated and will be removed in future')
151 }
152
153 if $log_date_format {
154 warning('gnocchi::logging::log_date_format is deprecated and will be removed in future')
155 }
156
110 # note(spredzy): in order to keep backward compatibility we rely on the pick function 157 # note(spredzy): in order to keep backward compatibility we rely on the pick function
111 # to use gnocchi::<myparam> first then gnocchi::logging::<myparam>. 158 # to use gnocchi::<myparam> first then gnocchi::logging::<myparam>.
112 $use_syslog_real = pick($::gnocchi::use_syslog,$use_syslog) 159 $use_syslog_real = pick($::gnocchi::use_syslog,$use_syslog)
@@ -116,22 +163,11 @@ class gnocchi::logging(
116 $debug_real = pick($::gnocchi::debug,$debug) 163 $debug_real = pick($::gnocchi::debug,$debug)
117 164
118 oslo::log { 'gnocchi_config': 165 oslo::log { 'gnocchi_config':
119 debug => $debug_real, 166 debug => $debug_real,
120 use_syslog => $use_syslog_real, 167 use_syslog => $use_syslog_real,
121 use_stderr => $use_stderr_real, 168 use_stderr => $use_stderr_real,
122 log_dir => $log_dir_real, 169 log_dir => $log_dir_real,
123 syslog_log_facility => $log_facility_real, 170 syslog_log_facility => $log_facility_real,
124 logging_context_format_string => $logging_context_format_string,
125 logging_default_format_string => $logging_default_format_string,
126 logging_debug_format_suffix => $logging_debug_format_suffix,
127 logging_exception_prefix => $logging_exception_prefix,
128 log_config_append => $log_config_append,
129 default_log_levels => $default_log_levels,
130 publish_errors => $publish_errors,
131 fatal_deprecations => $fatal_deprecations,
132 instance_format => $instance_format,
133 instance_uuid_format => $instance_uuid_format,
134 log_date_format => $log_date_format,
135 } 171 }
136 172
137} 173}
diff --git a/releasenotes/notes/deprecate-oslo-log-params-12ed30a5db0e5baf.yaml b/releasenotes/notes/deprecate-oslo-log-params-12ed30a5db0e5baf.yaml
new file mode 100644
index 0000000..a76d0e5
--- /dev/null
+++ b/releasenotes/notes/deprecate-oslo-log-params-12ed30a5db0e5baf.yaml
@@ -0,0 +1,4 @@
1---
2deprecations:
3 - Deprecating some oslo.log options from logging class. Gnocchi is moving
4 away from oslo.log to daiquri.
diff --git a/spec/classes/gnocchi_logging_spec.rb b/spec/classes/gnocchi_logging_spec.rb
index e0f0a92..0ab5cff 100644
--- a/spec/classes/gnocchi_logging_spec.rb
+++ b/spec/classes/gnocchi_logging_spec.rb
@@ -9,20 +9,6 @@ describe 'gnocchi::logging' do
9 9
10 let :log_params do 10 let :log_params do
11 { 11 {
12 :logging_context_format_string => '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user_identity)s] %(instance)s%(message)s',
13 :logging_default_format_string => '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s',
14 :logging_debug_format_suffix => '%(funcName)s %(pathname)s:%(lineno)d',
15 :logging_exception_prefix => '%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s',
16 :log_config_append => '/etc/gnocchi/logging.conf',
17 :publish_errors => true,
18 :default_log_levels => {
19 'amqp' => 'WARN', 'amqplib' => 'WARN', 'boto' => 'WARN',
20 'sqlalchemy' => 'WARN', 'suds' => 'INFO', 'iso8601' => 'WARN',
21 'requests.packages.urllib3.connectionpool' => 'WARN' },
22 :fatal_deprecations => true,
23 :instance_format => '[instance: %(uuid)s] ',
24 :instance_uuid_format => '[instance: %(uuid)s] ',
25 :log_date_format => '%Y-%m-%d %H:%M:%S',
26 :use_syslog => true, 12 :use_syslog => true,
27 :use_stderr => false, 13 :use_stderr => false,
28 :log_facility => 'LOG_FOO', 14 :log_facility => 'LOG_FOO',
@@ -42,15 +28,6 @@ describe 'gnocchi::logging' do
42 it_configures 'basic non-default logging settings' 28 it_configures 'basic non-default logging settings'
43 end 29 end
44 30
45 context 'with extended logging options' do
46 before { params.merge!( log_params ) }
47 it_configures 'logging params set'
48 end
49
50 context 'without extended logging options' do
51 it_configures 'logging params unset'
52 end
53
54 end 31 end
55 32
56 shared_examples 'basic default logging settings' do 33 shared_examples 'basic default logging settings' do
@@ -77,39 +54,6 @@ describe 'gnocchi::logging' do
77 end 54 end
78 end 55 end
79 56
80 shared_examples_for 'logging params set' do
81 it 'enables logging params' do
82 is_expected.to contain_oslo__log('gnocchi_config').with(
83 :logging_context_format_string =>
84 '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user_identity)s] %(instance)s%(message)s',
85 :logging_default_format_string => '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s',
86 :logging_debug_format_suffix => '%(funcName)s %(pathname)s:%(lineno)d',
87 :logging_exception_prefix => '%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s',
88 :log_config_append => '/etc/gnocchi/logging.conf',
89 :publish_errors => true,
90 :default_log_levels => {
91 'amqp' => 'WARN', 'amqplib' => 'WARN', 'boto' => 'WARN',
92 'sqlalchemy' => 'WARN', 'suds' => 'INFO', 'iso8601' => 'WARN',
93 'requests.packages.urllib3.connectionpool' => 'WARN' },
94 :fatal_deprecations => true,
95 :instance_format => '[instance: %(uuid)s] ',
96 :instance_uuid_format => '[instance: %(uuid)s] ',
97 :log_date_format => '%Y-%m-%d %H:%M:%S',
98 )
99 end
100 end
101
102 shared_examples_for 'logging params unset' do
103 [ :logging_context_format_string, :logging_default_format_string,
104 :logging_debug_format_suffix, :logging_exception_prefix,
105 :log_config_append, :publish_errors,
106 :default_log_levels, :fatal_deprecations,
107 :instance_format, :instance_uuid_format,
108 :log_date_format, ].each { |param|
109 it { is_expected.to contain_oslo__log('gnocchi_config').with("#{param}" => '<SERVICE DEFAULT>') }
110 }
111 end
112
113 on_supported_os({ 57 on_supported_os({
114 :supported_os => OSDefaults.get_supported_os 58 :supported_os => OSDefaults.get_supported_os
115 }).each do |os,facts| 59 }).each do |os,facts|