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)
This commit is contained in:
Sergey Kolekonov 2015-08-07 15:44:19 +03:00 committed by Michal Rostecki
parent 7a10ce15e7
commit b9d8442ca2
4 changed files with 25 additions and 4 deletions

View File

@ -120,6 +120,10 @@
# (optional) Use syslog for logging. # (optional) Use syslog for logging.
# Defaults to false. # Defaults to false.
# #
# [*use_stderr*]
# (optional) Use stderr for logging
# Defaults to true
#
# [*log_facility*] # [*log_facility*]
# (optional) Syslog facility to receive log lines. # (optional) Syslog facility to receive log lines.
# Defaults to 'LOG_USER'. # Defaults to 'LOG_USER'.
@ -185,6 +189,7 @@ class glance::api(
$keystone_user = 'glance', $keystone_user = 'glance',
$enabled = true, $enabled = true,
$use_syslog = false, $use_syslog = false,
$use_stderr = true,
$log_facility = 'LOG_USER', $log_facility = 'LOG_USER',
$show_image_direct_url = false, $show_image_direct_url = false,
$purge_config = false, $purge_config = false,
@ -267,6 +272,7 @@ class glance::api(
glance_api_config { glance_api_config {
'DEFAULT/verbose': value => $verbose; 'DEFAULT/verbose': value => $verbose;
'DEFAULT/debug': value => $debug; 'DEFAULT/debug': value => $debug;
'DEFAULT/use_stderr': value => $use_stderr;
'DEFAULT/bind_host': value => $bind_host; 'DEFAULT/bind_host': value => $bind_host;
'DEFAULT/bind_port': value => $bind_port; 'DEFAULT/bind_port': value => $bind_port;
'DEFAULT/backlog': value => $backlog; 'DEFAULT/backlog': value => $backlog;

View File

@ -80,6 +80,10 @@
# (optional) Use syslog for logging. # (optional) Use syslog for logging.
# Defaults to false. # Defaults to false.
# #
# [*use_stderr*]
# (optional) Use stderr for logging
# Defaults to true
#
# [*log_facility*] # [*log_facility*]
# (optional) Syslog facility to receive log lines. # (optional) Syslog facility to receive log lines.
# Defaults to LOG_USER. # Defaults to LOG_USER.
@ -129,6 +133,7 @@ class glance::registry(
$keystone_user = 'glance', $keystone_user = 'glance',
$pipeline = 'keystone', $pipeline = 'keystone',
$use_syslog = false, $use_syslog = false,
$use_stderr = true,
$log_facility = 'LOG_USER', $log_facility = 'LOG_USER',
$enabled = true, $enabled = true,
$purge_config = false, $purge_config = false,
@ -198,10 +203,11 @@ class glance::registry(
} }
glance_registry_config { glance_registry_config {
'DEFAULT/verbose': value => $verbose; 'DEFAULT/verbose': value => $verbose;
'DEFAULT/debug': value => $debug; 'DEFAULT/debug': value => $debug;
'DEFAULT/bind_host': value => $bind_host; 'DEFAULT/bind_host': value => $bind_host;
'DEFAULT/bind_port': value => $bind_port; 'DEFAULT/bind_port': value => $bind_port;
'DEFAULT/use_stderr': value => $use_stderr;
} }
if $auth_uri { if $auth_uri {

View File

@ -13,6 +13,7 @@ describe 'glance::api' do
{ {
:verbose => false, :verbose => false,
:debug => false, :debug => false,
:use_stderr => true,
:bind_host => '0.0.0.0', :bind_host => '0.0.0.0',
:bind_port => '9292', :bind_port => '9292',
:registry_host => '0.0.0.0', :registry_host => '0.0.0.0',
@ -91,6 +92,7 @@ describe 'glance::api' do
[ [
'verbose', 'verbose',
'debug', 'debug',
'use_stderr',
'bind_host', 'bind_host',
'bind_port', 'bind_port',
'registry_host', 'registry_host',

View File

@ -11,6 +11,7 @@ describe 'glance::registry' do
{ {
:verbose => false, :verbose => false,
:debug => false, :debug => false,
:use_stderr => true,
:bind_host => '0.0.0.0', :bind_host => '0.0.0.0',
:bind_port => '9191', :bind_port => '9191',
:log_file => '/var/log/glance/registry.log', :log_file => '/var/log/glance/registry.log',
@ -257,6 +258,12 @@ describe 'glance::registry' do
it { should contain_glance_registry_config('DEFAULT/key_file').with_ensure('absent')} it { should contain_glance_registry_config('DEFAULT/key_file').with_ensure('absent')}
end end
describe 'with use_stderr enabled (default)' do
let(:params) { default_params }
it { should contain_glance_registry_config('DEFAULT/use_stderr').with_value('true')}
end
describe 'with ssl options' do describe 'with ssl options' do
let :params do let :params do
default_params.merge({ default_params.merge({