Browse Source

Add an ability to manage use_stderr parameter

When logging is already set up, it can be useful to disable this option
to avoid logs duplication (collected by Upstart, for example)

Change-Id: I1787191d9a512fdd3c3f79d6fadda110c5e41d54
Closes-bug: #1482564
(cherry picked from commit 1f4a545247)
tags/icehouse-eol^0
Sergey Kolekonov 3 years ago
parent
commit
b9d8442ca2
4 changed files with 25 additions and 4 deletions
  1. 6
    0
      manifests/api.pp
  2. 10
    4
      manifests/registry.pp
  3. 2
    0
      spec/classes/glance_api_spec.rb
  4. 7
    0
      spec/classes/glance_registry_spec.rb

+ 6
- 0
manifests/api.pp View File

@@ -120,6 +120,10 @@
120 120
 #   (optional) Use syslog for logging.
121 121
 #   Defaults to false.
122 122
 #
123
+# [*use_stderr*]
124
+#   (optional) Use stderr for logging
125
+#   Defaults to true
126
+#
123 127
 # [*log_facility*]
124 128
 #   (optional) Syslog facility to receive log lines.
125 129
 #   Defaults to 'LOG_USER'.
@@ -185,6 +189,7 @@ class glance::api(
185 189
   $keystone_user            = 'glance',
186 190
   $enabled                  = true,
187 191
   $use_syslog               = false,
192
+  $use_stderr               = true,
188 193
   $log_facility             = 'LOG_USER',
189 194
   $show_image_direct_url    = false,
190 195
   $purge_config             = false,
@@ -267,6 +272,7 @@ class glance::api(
267 272
   glance_api_config {
268 273
     'DEFAULT/verbose':               value => $verbose;
269 274
     'DEFAULT/debug':                 value => $debug;
275
+    'DEFAULT/use_stderr':            value => $use_stderr;
270 276
     'DEFAULT/bind_host':             value => $bind_host;
271 277
     'DEFAULT/bind_port':             value => $bind_port;
272 278
     'DEFAULT/backlog':               value => $backlog;

+ 10
- 4
manifests/registry.pp View File

@@ -80,6 +80,10 @@
80 80
 #    (optional) Use syslog for logging.
81 81
 #    Defaults to false.
82 82
 #
83
+# [*use_stderr*]
84
+#   (optional) Use stderr for logging
85
+#   Defaults to true
86
+#
83 87
 #  [*log_facility*]
84 88
 #    (optional) Syslog facility to receive log lines.
85 89
 #    Defaults to LOG_USER.
@@ -129,6 +133,7 @@ class glance::registry(
129 133
   $keystone_user         = 'glance',
130 134
   $pipeline              = 'keystone',
131 135
   $use_syslog            = false,
136
+  $use_stderr            = true,
132 137
   $log_facility          = 'LOG_USER',
133 138
   $enabled               = true,
134 139
   $purge_config          = false,
@@ -198,10 +203,11 @@ class glance::registry(
198 203
   }
199 204
 
200 205
   glance_registry_config {
201
-    'DEFAULT/verbose':   value => $verbose;
202
-    'DEFAULT/debug':     value => $debug;
203
-    'DEFAULT/bind_host': value => $bind_host;
204
-    'DEFAULT/bind_port': value => $bind_port;
206
+    'DEFAULT/verbose':    value => $verbose;
207
+    'DEFAULT/debug':      value => $debug;
208
+    'DEFAULT/bind_host':  value => $bind_host;
209
+    'DEFAULT/bind_port':  value => $bind_port;
210
+    'DEFAULT/use_stderr': value => $use_stderr;
205 211
   }
206 212
 
207 213
   if $auth_uri {

+ 2
- 0
spec/classes/glance_api_spec.rb View File

@@ -13,6 +13,7 @@ describe 'glance::api' do
13 13
     {
14 14
       :verbose                  => false,
15 15
       :debug                    => false,
16
+      :use_stderr               => true,
16 17
       :bind_host                => '0.0.0.0',
17 18
       :bind_port                => '9292',
18 19
       :registry_host            => '0.0.0.0',
@@ -91,6 +92,7 @@ describe 'glance::api' do
91 92
         [
92 93
           'verbose',
93 94
           'debug',
95
+          'use_stderr',
94 96
           'bind_host',
95 97
           'bind_port',
96 98
           'registry_host',

+ 7
- 0
spec/classes/glance_registry_spec.rb View File

@@ -11,6 +11,7 @@ describe 'glance::registry' do
11 11
     {
12 12
       :verbose                => false,
13 13
       :debug                  => false,
14
+      :use_stderr             => true,
14 15
       :bind_host              => '0.0.0.0',
15 16
       :bind_port              => '9191',
16 17
       :log_file               => '/var/log/glance/registry.log',
@@ -257,6 +258,12 @@ describe 'glance::registry' do
257 258
     it { should contain_glance_registry_config('DEFAULT/key_file').with_ensure('absent')}
258 259
   end
259 260
 
261
+  describe 'with use_stderr enabled (default)' do
262
+    let(:params) { default_params }
263
+
264
+    it { should contain_glance_registry_config('DEFAULT/use_stderr').with_value('true')}
265
+  end
266
+
260 267
   describe 'with ssl options' do
261 268
     let :params do
262 269
       default_params.merge({

Loading…
Cancel
Save