From eb6d4a58690e44569bc0a9a8a970c5c3a98619aa Mon Sep 17 00:00:00 2001 From: Liao Penghui Date: Mon, 7 Mar 2016 09:50:29 +0800 Subject: [PATCH] Support custom TIME_ZONE option in localsettings This patch aims to add support for customization of TIME_ZONE option which may be needed by global users. Closes-Bug: #1553835 Change-Id: Id7b2c6776c0021b7c887ad6c4a4de8d15801984b --- manifests/init.pp | 5 +++++ spec/classes/horizon_init_spec.rb | 5 ++++- templates/local_settings.py.erb | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 43d96127..289e36b7 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -265,6 +265,10 @@ # the user is logged out. # Defaults to 1800. # +# [*timezone*] +# (optional) The timezone of the server. +# Defaults to 'UTC'. +# # === Examples # # class { 'horizon': @@ -327,6 +331,7 @@ class horizon( $overview_days_range = undef, $root_url = $::horizon::params::root_url, $session_timeout = 1800, + $timezone = 'UTC', # DEPRECATED PARAMETERS $can_set_mount_point = undef, $vhost_extra_params = undef, diff --git a/spec/classes/horizon_init_spec.rb b/spec/classes/horizon_init_spec.rb index 5dd8cc2f..b39cb937 100644 --- a/spec/classes/horizon_init_spec.rb +++ b/spec/classes/horizon_init_spec.rb @@ -72,6 +72,7 @@ describe 'horizon' do " 'enable_security_group': True,", " 'enable_vpn': False,", 'API_RESULT_LIMIT = 1000', + 'TIME_ZONE = "UTC"', 'COMPRESS_OFFLINE = True', "FILE_UPLOAD_TEMP_DIR = '/tmp'" ]) @@ -115,7 +116,8 @@ describe 'horizon' do :keystone_multidomain_support => true, :keystone_default_domain => 'domain.tld', :overview_days_range => 1, - :session_timeout => 1800 + :session_timeout => 1800, + :timezone => 'Asia/Shanghai', }) end @@ -153,6 +155,7 @@ describe 'horizon' do 'OPENSTACK_ENDPOINT_TYPE = "internalURL"', 'SECONDARY_ENDPOINT_TYPE = "ANY-VALUE"', 'API_RESULT_LIMIT = 4682', + 'TIME_ZONE = "Asia/Shanghai"', "CUSTOM_THEME_PATH = 'static/themes/green'", " 'level': 'DEBUG',", " 'handlers': ['syslog'],", diff --git a/templates/local_settings.py.erb b/templates/local_settings.py.erb index a376cbfd..537efd88 100644 --- a/templates/local_settings.py.erb +++ b/templates/local_settings.py.erb @@ -477,7 +477,7 @@ API_RESULT_PAGE_SIZE = 20 # The timezone of the server. This should correspond with the timezone # of your entire OpenStack installation, and hopefully be in UTC. -TIME_ZONE = "UTC" +TIME_ZONE = "<%= @timezone %>" # If you have external monitoring links, eg: <% if @horizon_app_links %>