Move pytz to 3rd party import, add to __virtual__

Add pytz to freezer includes
This commit is contained in:
twangboy 2018-05-25 11:46:45 -06:00
parent b8a6488688
commit 72cc361c7b
No known key found for this signature in database
GPG key ID: 93FF3BDEB278C9EB
2 changed files with 10 additions and 1 deletions

View file

@ -6,12 +6,18 @@ from __future__ import absolute_import, unicode_literals, print_function
# Import Python libs
import logging
import pytz
from datetime import datetime
# Import Salt libs
from salt.exceptions import CommandExecutionError
# Import 3rd party libs
try:
import pytz
HAS_PYTZ = True
except ImportError:
HAS_PYTZ = False
log = logging.getLogger(__name__)
# Define the module's virtual name
@ -185,6 +191,8 @@ def __virtual__():
'''
if not __utils__['platform.is_windows']():
return False, "Module win_timezone: Not on Windows client"
if not HAS_PYTZ:
return False, "Module win_timezone: pytz not found"
if not __utils__['path.which']('tzutil'):
return False, "Module win_timezone: tzutil not found"
return __virtualname__

View file

@ -1121,6 +1121,7 @@ class SaltDistribution(distutils.dist.Distribution):
'wmi',
'site',
'psutil',
'pytz',
])
elif IS_SMARTOS_PLATFORM:
# we have them as requirements in pkg/smartos/esky/requirements.txt