diff --git a/salt/modules/win_timezone.py b/salt/modules/win_timezone.py index 9e4092d865f..7178dcb7e4d 100644 --- a/salt/modules/win_timezone.py +++ b/salt/modules/win_timezone.py @@ -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__ diff --git a/setup.py b/setup.py index 0841c935536..3ccbf47f978 100755 --- a/setup.py +++ b/setup.py @@ -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