diff --git a/manifests/init.pp b/manifests/init.pp index afc7de3d..963234cf 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -92,8 +92,8 @@ # (optional) Specify a maximum number of items to display in a dropdown. # Defaults to 30 # -# [*log_handler*] -# (optional) Log handler. Defaults to 'file' +# [*log_handlers*] +# (optional) Log handlers. Defaults to ['file'] # # [*log_level*] # (optional) Log level. Defaults to 'INFO'. WARNING: Setting this to @@ -450,6 +450,11 @@ # will disable the function in Horizon, direct will allow the user agent to directly # talk to the glance-api. # +# DEPRECATED PARAMETERS +# +# [*log_handler*] +# (optional) Log handler. Defaults to 'file' +# # === Examples # # class { 'horizon': @@ -480,7 +485,7 @@ class horizon( $available_regions = undef, $api_result_limit = 1000, $dropdown_max_items = 30, - $log_handler = 'file', + $log_handlers = ['file'], $log_level = 'INFO', $help_url = 'http://docs.openstack.org', $local_settings_template = 'horizon/local_settings.py.erb', @@ -543,10 +548,21 @@ class horizon( $enable_user_pass = true, $customization_module = undef, $horizon_upload_mode = undef, + # DEPRECATED PARAMETERS + $log_handler = undef, ) inherits ::horizon::params { include horizon::deps + if $log_handler != undef { + warning('log_handler parameter was deprecated and will be removed in a future \ +release. Use log_handlers instead') + $log_handlers_real = [$log_handler] + } else { + validate_legacy(Array, 'validate_array', $log_handlers) + $log_handlers_real = $log_handlers + } + if $cache_server_url and $cache_server_ip { fail('Only one of cache_server_url or cache_server_ip can be set.') } diff --git a/releasenotes/notes/multiple-log_handlers-5b7157cb351f0bec.yaml b/releasenotes/notes/multiple-log_handlers-5b7157cb351f0bec.yaml new file mode 100644 index 00000000..654be7e3 --- /dev/null +++ b/releasenotes/notes/multiple-log_handlers-5b7157cb351f0bec.yaml @@ -0,0 +1,11 @@ +--- +features: + - | + The new ``horizon::log_handlers`` parameter was added to specify multiple + log handlers. + +deprecations: + - | + The ``horizon::log_handler`` parameter has been deprecated in favor of + the ``horizon::log_handlers`` parameter and will be removed in a future + release. diff --git a/spec/classes/horizon_init_spec.rb b/spec/classes/horizon_init_spec.rb index 43ae18c8..f6ad1e9c 100644 --- a/spec/classes/horizon_init_spec.rb +++ b/spec/classes/horizon_init_spec.rb @@ -78,6 +78,7 @@ describe 'horizon' do 'API_RESULT_LIMIT = 1000', 'DROPDOWN_MAX_ITEMS = 30', 'TIME_ZONE = "UTC"', + " 'handlers': ['file'],", 'COMPRESS_OFFLINE = True', "FILE_UPLOAD_TEMP_DIR = '/tmp'", "OPENSTACK_HEAT_STACK = {", @@ -105,7 +106,7 @@ describe 'horizon' do :keystone_default_role => 'SwiftOperator', :keystone_url => 'https://keystone.example.com:4682', :ssl_no_verify => true, - :log_handler => 'syslog', + :log_handlers => ['console', 'syslog'], :log_level => 'DEBUG', :openstack_endpoint_type => 'internalURL', :secondary_endpoint_type => 'ANY-VALUE', @@ -209,7 +210,7 @@ describe 'horizon' do "]", "DEFAULT_THEME = 'default'", " 'level': 'DEBUG',", - " 'handlers': ['syslog'],", + " 'handlers': ['console', 'syslog'],", "SESSION_TIMEOUT = 1800", 'COMPRESS_OFFLINE = False', "FILE_UPLOAD_TEMP_DIR = '/var/spool/horizon'", diff --git a/templates/local_settings.py.erb b/templates/local_settings.py.erb index 0cc320ae..8fc48df2 100644 --- a/templates/local_settings.py.erb +++ b/templates/local_settings.py.erb @@ -721,7 +721,7 @@ LOGGING = { 'filename': '<%= scope.lookupvar("horizon::params::logdir") %>/horizon.log', 'formatter': 'verbose', }, - <%- if @log_handler == 'syslog' -%> + <%- if @log_handlers_real.include?('syslog') -%> 'syslog': { 'level': '<%= @log_level %>', 'facility': 'local1', @@ -744,91 +744,91 @@ LOGGING = { }, 'horizon': { # 'handlers': ['console'], - 'handlers': ['<%= @log_handler %>'], + 'handlers': ['<%= @log_handlers_real.join("', '") %>'], # 'level': 'DEBUG', 'level': '<%= @log_level %>', 'propagate': False, }, 'openstack_dashboard': { # 'handlers': ['console'], - 'handlers': ['<%= @log_handler %>'], + 'handlers': ['<%= @log_handlers_real.join("', '") %>'], # 'level': 'DEBUG', 'level': '<%= @log_level %>', 'propagate': False, }, 'novaclient': { # 'handlers': ['console'], - 'handlers': ['<%= @log_handler %>'], + 'handlers': ['<%= @log_handlers_real.join("', '") %>'], # 'level': 'DEBUG', 'level': '<%= @log_level %>', 'propagate': False, }, 'cinderclient': { # 'handlers': ['console'], - 'handlers': ['<%= @log_handler %>'], + 'handlers': ['<%= @log_handlers_real.join("', '") %>'], # 'level': 'DEBUG', 'level': '<%= @log_level %>', 'propagate': False, }, 'keystoneclient': { # 'handlers': ['console'], - 'handlers': ['<%= @log_handler %>'], + 'handlers': ['<%= @log_handlers_real.join("', '") %>'], # 'level': 'DEBUG', 'level': '<%= @log_level %>', 'propagate': False, }, 'glanceclient': { # 'handlers': ['console'], - 'handlers': ['<%= @log_handler %>'], + 'handlers': ['<%= @log_handlers_real.join("', '") %>'], # 'level': 'DEBUG', 'level': '<%= @log_level %>', 'propagate': False, }, 'neutronclient': { # 'handlers': ['console'], - 'handlers': ['<%= @log_handler %>'], + 'handlers': ['<%= @log_handlers_real.join("', '") %>'], # 'level': 'DEBUG', 'level': '<%= @log_level %>', 'propagate': False, }, 'heatclient': { # 'handlers': ['console'], - 'handlers': ['<%= @log_handler %>'], + 'handlers': ['<%= @log_handlers_real.join("', '") %>'], # 'level': 'DEBUG', 'level': '<%= @log_level %>', 'propagate': False, }, 'troveclient': { # 'handlers': ['console'], - 'handlers': ['<%= @log_handler %>'], + 'handlers': ['<%= @log_handlers_real.join("', '") %>'], # 'level': 'DEBUG', 'level': '<%= @log_level %>', 'propagate': False, }, 'swiftclient': { # 'handlers': ['console'], - 'handlers': ['<%= @log_handler %>'], + 'handlers': ['<%= @log_handlers_real.join("', '") %>'], # 'level': 'DEBUG', 'level': '<%= @log_level %>', 'propagate': False, }, 'openstack_auth': { # 'handlers': ['console'], - 'handlers': ['<%= @log_handler %>'], + 'handlers': ['<%= @log_handlers_real.join("', '") %>'], # 'level': 'DEBUG', 'level': '<%= @log_level %>', 'propagate': False, }, 'nose.plugins.manager': { # 'handlers': ['console'], - 'handlers': ['<%= @log_handler %>'], + 'handlers': ['<%= @log_handlers_real.join("', '") %>'], # 'level': 'DEBUG', 'level': '<%= @log_level %>', 'propagate': False, }, 'django': { # 'handlers': ['console'], - 'handlers': ['<%= @log_handler %>'], + 'handlers': ['<%= @log_handlers_real.join("', '") %>'], # 'level': 'DEBUG', 'level': '<%= @log_level %>', 'propagate': False,