mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add timezone.list, add 2018.3.2 release notes
This commit is contained in:
parent
986f6c9b2a
commit
5656183c5e
2 changed files with 56 additions and 1 deletions
16
doc/topics/releases/2018.3.2.rst
Normal file
16
doc/topics/releases/2018.3.2.rst
Normal file
|
@ -0,0 +1,16 @@
|
|||
===========================
|
||||
In Progress: Salt 2018.3.2 Release Notes
|
||||
===========================
|
||||
|
||||
Version 2018.3.2 is an **unreleased** bugfix release for :ref:`2018.3.0 <release-2018-3-0>`.
|
||||
This release is still in progress and has not been released yet.
|
||||
|
||||
Changes to win_timezone
|
||||
-----------------------
|
||||
|
||||
Improves timezone detection by using the pytz module.
|
||||
|
||||
``timezone.get_offset`` and ``timezone.get_zonecode`` now work properly.
|
||||
|
||||
Adds ``timezone.list`` to list supported timezones in either Windows or Unix
|
||||
format.
|
|
@ -39,6 +39,12 @@ class TzMapper(object):
|
|||
def get_unix(self, key, default=None):
|
||||
return self.win_to_unix.get(key.lower(), default)
|
||||
|
||||
def list_win(self):
|
||||
return sorted(self.unix_to_win.values())
|
||||
|
||||
def list_unix(self):
|
||||
return sorted(self.win_to_unix.values())
|
||||
|
||||
|
||||
mapper = TzMapper({
|
||||
'AUS Central Standard Time': 'Australia/Darwin',
|
||||
|
@ -288,7 +294,9 @@ def zone_compare(timezone):
|
|||
running state checks.
|
||||
|
||||
Args:
|
||||
timezone (str): The timezone to compare
|
||||
timezone (str):
|
||||
The timezone to compare. This can be in Windows or Unix format. Can
|
||||
be any of the values returned by the ``timezone.list`` function
|
||||
|
||||
Returns:
|
||||
bool: ``True`` if they match, otherwise ``False``
|
||||
|
@ -315,6 +323,37 @@ def zone_compare(timezone):
|
|||
return get_zone() == mapper.get_unix(check_zone, 'Unknown')
|
||||
|
||||
|
||||
def list(unix_style=True):
|
||||
'''
|
||||
Return a list of Timezones that this module supports. These can be in either
|
||||
Unix or Windows format.
|
||||
|
||||
.. version-added:: 2018.3.2
|
||||
|
||||
Args:
|
||||
unix_style (bool):
|
||||
``True`` returns Unix-style timezones. ``False`` returns
|
||||
Windows-style timezones. Default is ``True``
|
||||
|
||||
Returns:
|
||||
list: A list of supported timezones
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Unix-style timezones
|
||||
salt '*' timezone.list
|
||||
|
||||
# Windows-style timezones
|
||||
salt '*' timezone.list unix_style=False
|
||||
'''
|
||||
if unix_style:
|
||||
return mapper.list_unix()
|
||||
else:
|
||||
return mapper.list_win()
|
||||
|
||||
|
||||
def get_hwclock():
|
||||
'''
|
||||
Get current hardware clock setting (UTC or localtime)
|
||||
|
|
Loading…
Add table
Reference in a new issue