From 5cf2e50fa3fb947c28f57704305c3e26fb2ca2d6 Mon Sep 17 00:00:00 2001 From: ZhongShengping Date: Tue, 14 Sep 2021 16:02:09 +0800 Subject: [PATCH] Add watch_log_file option Add support for Using logging handler designed to watch file system. Change-Id: Id40a6d6882a7468536de93318a6a59c134eef938 Closes-Bug: #1943212 --- manifests/logging.pp | 6 ++++++ ..._watch_log_file-option-935931045c6c0498.yaml | 4 ++++ spec/classes/nova_logging_spec.rb | 17 ++++++++++------- 3 files changed, 20 insertions(+), 7 deletions(-) create mode 100644 releasenotes/notes/add_watch_log_file-option-935931045c6c0498.yaml diff --git a/manifests/logging.pp b/manifests/logging.pp index 0409ebf4c..b7e8a85a0 100644 --- a/manifests/logging.pp +++ b/manifests/logging.pp @@ -37,6 +37,10 @@ # (Optional) File where logs should be stored. # Defaults to $::os_service_default # +# [*watch_log_file*] +# (Optional) Uses logging handler designed to watch file system (boolean value). +# Defaults to $::os_service_default +# # [*logging_context_format_string*] # (Optional) Format string to use for log messages with context. # Defaults to $::os_service_default @@ -105,6 +109,7 @@ class nova::logging( $log_facility = $::os_service_default, $log_dir = '/var/log/nova', $log_file = $::os_service_default, + $watch_log_file = $::os_service_default, $debug = $::os_service_default, $logging_context_format_string = $::os_service_default, $logging_default_format_string = $::os_service_default, @@ -140,6 +145,7 @@ class nova::logging( use_journal => $use_journal, log_dir => $log_dir, log_file => $log_file, + watch_log_file => $watch_log_file, syslog_log_facility => $log_facility, logging_context_format_string => $logging_context_format_string, logging_default_format_string => $logging_default_format_string, diff --git a/releasenotes/notes/add_watch_log_file-option-935931045c6c0498.yaml b/releasenotes/notes/add_watch_log_file-option-935931045c6c0498.yaml new file mode 100644 index 000000000..43ea31a41 --- /dev/null +++ b/releasenotes/notes/add_watch_log_file-option-935931045c6c0498.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + The new ``nova::logging::watch_log_file`` parameter has been added. diff --git a/spec/classes/nova_logging_spec.rb b/spec/classes/nova_logging_spec.rb index f8bb73eda..124c2e102 100644 --- a/spec/classes/nova_logging_spec.rb +++ b/spec/classes/nova_logging_spec.rb @@ -30,6 +30,7 @@ describe 'nova::logging' do :log_facility => 'LOG_FOO', :log_dir => '/var/log/foo', :log_file => '/var/log/foo/nova.log', + :watch_log_file => true, :debug => true, } end @@ -59,13 +60,14 @@ describe 'nova::logging' do shared_examples 'basic default logging settings' do it 'configures nova logging settings with default values' do is_expected.to contain_oslo__log('nova_config').with( - :use_syslog => '', - :use_json => '', - :use_journal => '', - :use_stderr => '', - :log_dir => '/var/log/nova', - :log_file => '', - :debug => '', + :use_syslog => '', + :use_json => '', + :use_journal => '', + :use_stderr => '', + :log_dir => '/var/log/nova', + :log_file => '', + :watch_log_file => '', + :debug => '', ) is_expected.to contain_file('/var/log/nova/nova-manage.log').with( :owner => 'nova', @@ -83,6 +85,7 @@ describe 'nova::logging' do :syslog_log_facility => 'LOG_FOO', :log_dir => '/var/log/foo', :log_file => '/var/log/foo/nova.log', + :watch_log_file => true, :debug => true, ) is_expected.to contain_file('/var/log/foo/nova-manage.log').with(