From fa5ce48c0968a6d01dd43a3559150fe7c6b13d98 Mon Sep 17 00:00:00 2001 From: Tobias Urdin Date: Wed, 4 Jul 2018 18:49:12 +0200 Subject: [PATCH] Deprecate nova::logging params in ::nova Deprecates the parameters in ::nova that should be set directly in the ::nova::logging class. We can then remove all the messy pick() calls and backward compatibility when this has been deprecated for a cycle. [1] [2] [1] https://github.com/openstack/puppet-nova/blob/e211fcfd65f3e1144ca9c29ff7314597e0989abc/manifests/logging.pp#L122-L130 [2] https://github.com/openstack/puppet-nova/blob/master/manifests/init.pp#L531 Change-Id: I0fb2def264bd72101612291708df26f143183c8a --- manifests/init.pp | 59 +++++++++++-------- manifests/logging.pp | 1 + ...cate-logging-in-init-3031e31ec5362e2c.yaml | 6 ++ spec/classes/nova_init_spec.rb | 3 +- 4 files changed, 41 insertions(+), 28 deletions(-) create mode 100644 releasenotes/notes/deprecate-logging-in-init-3031e31ec5362e2c.yaml diff --git a/manifests/init.pp b/manifests/init.pp index 89c72ab83..a8d45ac03 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -221,11 +221,6 @@ # (optional) Maximum time since last check-in for up service. # Defaults to 60 # -# [*log_dir*] -# (optional) Directory where logs should be stored. -# If set to $::os_service_default, it will not log to any directory. -# Defaults to undef -# # [*state_path*] # (optional) Directory for storing state. # Defaults to '/var/lib/nova' @@ -235,10 +230,6 @@ # On RHEL will be '/var/lib/nova/tmp' and on Debian '/var/lock/nova' # Defaults to $::nova::params::lock_path # -# [*debug*] -# (optional) Set log output to debug output. -# Defaults to undef -# # [*periodic_interval*] # (optional) Seconds between running periodic tasks. # Defaults to '60' @@ -251,18 +242,6 @@ # (optional) Path to the rootwrap configuration file to use for running commands as root # Defaults to '/etc/nova/rootwrap.conf' # -# [*use_syslog*] -# (optional) Use syslog for logging -# Defaults to undef -# -# [*use_stderr*] -# (optional) Use stderr for logging -# Defaults to undef -# -# [*log_facility*] -# (optional) Syslog facility to receive log lines. -# Defaults to undef -# # [*use_ssl*] # (optional) Enable SSL on the API server # Defaults to false, not set @@ -426,6 +405,27 @@ # exceptions in the API service # Defaults to undef # +# [*use_syslog*] +# (optional) Use syslog for logging +# Defaults to undef +# +# [*use_stderr*] +# (optional) Use stderr for logging +# Defaults to undef +# +# [*log_facility*] +# (optional) Syslog facility to receive log lines. +# Defaults to undef +# +# [*log_dir*] +# (optional) Directory where logs should be stored. +# If set to $::os_service_default, it will not log to any directory. +# Defaults to undef +# +# [*debug*] +# (optional) Set log output to debug output. +# Defaults to undef +# class nova( $ensure_package = 'present', $database_connection = undef, @@ -480,10 +480,8 @@ class nova( $host = $::os_service_default, $auth_strategy = 'keystone', $service_down_time = 60, - $log_dir = undef, $state_path = '/var/lib/nova', $lock_path = $::nova::params::lock_path, - $debug = undef, $periodic_interval = '60', $report_interval = '10', $rootwrap_config = '/etc/nova/rootwrap.conf', @@ -494,9 +492,6 @@ class nova( $key_file = false, $nova_public_key = undef, $nova_private_key = undef, - $use_syslog = undef, - $use_stderr = undef, - $log_facility = undef, $notification_transport_url = $::os_service_default, $notification_driver = $::os_service_default, $notification_topics = $::os_service_default, @@ -522,13 +517,25 @@ class nova( $my_ip = $::os_service_default, # DEPRECATED PARAMETERS $notify_api_faults = undef, + $use_syslog = undef, + $use_stderr = undef, + $log_facility = undef, + $log_dir = undef, + $debug = undef, ) inherits nova::params { include ::nova::deps # maintain backward compatibility include ::nova::db + + # TODO(tobasco): Remove when use_syslog, use_stderr, log_facility, log_dir + # and debug parameters is removed from here. include ::nova::logging + if ($use_syslog or $use_stderr or $log_facility or $log_dir or $debug) { + warning('nova::use_syslog, nova::use_stderr, nova::log_facility, nova::log_dir \ +and nova::debug is deprecated and has been moved to nova::logging class, please set them there.') + } validate_array($enabled_ssl_apis) if empty($enabled_ssl_apis) and $use_ssl { diff --git a/manifests/logging.pp b/manifests/logging.pp index c36482c81..6517a9042 100644 --- a/manifests/logging.pp +++ b/manifests/logging.pp @@ -119,6 +119,7 @@ class nova::logging( # NOTE(spredzy): In order to keep backward compatibility we rely on the pick function # to use nova:: first then nova::logging::. + # TODO(tobasco): Remove these when they have been deprecated for atleast one cycle. $use_syslog_real = pick($::nova::use_syslog,$use_syslog) $use_stderr_real = pick($::nova::use_stderr,$use_stderr) $log_facility_real = pick($::nova::log_facility,$log_facility) diff --git a/releasenotes/notes/deprecate-logging-in-init-3031e31ec5362e2c.yaml b/releasenotes/notes/deprecate-logging-in-init-3031e31ec5362e2c.yaml new file mode 100644 index 000000000..72dbe925b --- /dev/null +++ b/releasenotes/notes/deprecate-logging-in-init-3031e31ec5362e2c.yaml @@ -0,0 +1,6 @@ +--- +deprecations: + - | + The parameters nova::use_syslog, nova::use_stderr, nova::log_facility, nova::log_dir + and nova::debug has been deprecated and moved to the nova::logging class, please use + them there. diff --git a/spec/classes/nova_init_spec.rb b/spec/classes/nova_init_spec.rb index 525a672e8..a79433d22 100644 --- a/spec/classes/nova_init_spec.rb +++ b/spec/classes/nova_init_spec.rb @@ -73,8 +73,7 @@ describe 'nova' do context 'with overridden parameters' do let :params do - { :debug => true, - :log_dir => '/var/log/nova2', + { :image_service => 'nova.image.local.LocalImageService', :default_transport_url => 'rabbit://rabbit_user:password@localhost:5673', :rpc_response_timeout => '30',