Expose timezone configuration

This change adds an undercloud_timezone configuration that can be used
to configure the timezone when we install the undercloud.

Change-Id: I5dcf3250a181c3614189618b9bae62e466b00275
Related-Bug: #1784068
This commit is contained in:
Alex Schultz 2019-01-02 10:54:39 -07:00
parent 7a6432aa45
commit cca24538d4
4 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,12 @@
---
features:
- |
Host timezone can be managed during the undercloud installation. The default
timezone is the timezone already configured for the system. The timezone
can be configured by setting undercloud_timezone in undercloud.conf
upgrade:
- |
Host timezone can be managed during the undercloud upgrade. The default
timezone is the timezone already configured for the system. The timezone
can be configured by setting undercloud_timezone in undercloud.conf and it
is recommended to set this going forward.

View File

@ -130,6 +130,10 @@ class UndercloudConfig(StandaloneConfig):
default=['0.pool.ntp.org', '1.pool.ntp.org',
'2.pool.ntp.org', '3.pool.ntp.org'],
help=_('List of ntp servers to use.')),
cfg.StrOpt('undercloud_timezone', default=None,
help=_('Host timezone to be used. If no timezone is '
'specified, the existing timezone configuration '
'is used.')),
cfg.StrOpt('overcloud_domain_name',
default='localdomain',
help=_(

View File

@ -71,6 +71,7 @@ class TestUndercloudConfig(base.TestCase):
'undercloud_ntp_servers',
'undercloud_public_host',
'undercloud_service_certificate',
'undercloud_timezone',
'undercloud_update_packages',
'upgrade_cleanup']
self.assertEqual(expected, [x.name for x in ret])
@ -133,6 +134,7 @@ class TestUndercloudConfig(base.TestCase):
'undercloud_ntp_servers',
'undercloud_public_host',
'undercloud_service_certificate',
'undercloud_timezone',
'undercloud_update_packages',
'upgrade_cleanup']
self.assertEqual(expected, [x.name for x in ret])

View File

@ -32,6 +32,7 @@ from jinja2 import meta
from osc_lib.i18n import _
from oslo_config import cfg
from time import strftime
from tripleo_common.image import kolla_builder
from tripleoclient.config.undercloud import load_global_config
@ -383,6 +384,11 @@ def prepare_undercloud_deploy(upgrade=False, no_validations=False,
if CONF.get('undercloud_ntp_servers', None):
env_data['NtpServer'] = CONF['undercloud_ntp_servers']
if CONF.get('undercloud_timezone', None):
env_data['TimeZone'] = CONF['undercloud_timezone']
else:
env_data['TimeZone'] = strftime("%Z")
if CONF.get('enable_validations', False):
env_data['UndercloudConfigFilePath'] = constants.UNDERCLOUD_CONF_PATH
if not no_validations: