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] e211fcfd65/manifests/logging.pp (L122-L130)
[2] https://github.com/openstack/puppet-nova/blob/master/manifests/init.pp#L531

Change-Id: I0fb2def264bd72101612291708df26f143183c8a
This commit is contained in:
Tobias Urdin 2018-07-04 18:49:12 +02:00
parent 40d402ff0f
commit fa5ce48c09
4 changed files with 41 additions and 28 deletions

View File

@ -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 {

View File

@ -119,6 +119,7 @@ class nova::logging(
# NOTE(spredzy): In order to keep backward compatibility we rely on the pick function
# to use nova::<myparam> first then nova::logging::<myparam>.
# 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)

View File

@ -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.

View File

@ -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',