%PDF- %PDF-
Direktori : /usr/lib/python2.7/site-packages/salt/modules/ |
Current File : //usr/lib/python2.7/site-packages/salt/modules/mac_timezone.pyc |
� ���^c @@ s d Z d d l m Z m Z m Z d d l m Z d d l Z d d l Z d d l m Z d Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d d � Z d � Z d � Z d S( uM Module for editing date/time settings on macOS .. versionadded:: 2016.3.0 i ( t absolute_importt unicode_literalst print_function( t datetimeN( t SaltInvocationErroru timezonec C@ s t j j j � s t d f St S( u Only for macOS uP The mac_timezone module could not be loaded: module only works on macOS systems.( t saltt utilst platformt is_darwint Falset __virtualname__( ( ( s= /usr/lib/python2.7/site-packages/salt/modules/mac_timezone.pyt __virtual__ s c C@ sw d d d d d d g } x= | D]5 } y t j | | � | SWq t k rS q q Xq Wd j | � } t | � � d S( u Function that detects the date/time format for the string passed. :param str dt_string: A date/time string :return: The format of the passed dt_string :rtype: str :raises: SaltInvocationError on Invalid Date/Time string u %H:%Mu %H:%M:%Su %m:%d:%yu %m:%d:%Yu %m/%d/%yu %m/%d/%Yu Invalid Date/Time Format: {0}N( R t strptimet ValueErrort formatR ( t dt_stringt valid_formatst dt_formatt msg( ( s= /usr/lib/python2.7/site-packages/salt/modules/mac_timezone.pyt _get_date_time_format s c C@ s( t j j j d � } t j j j | � S( u� Displays the current date :return: the system date :rtype: str CLI Example: .. code-block:: bash salt '*' timezone.get_date u systemsetup -getdate( R R t mac_utilst execute_return_resultt parse_return( t ret( ( s= /usr/lib/python2.7/site-packages/salt/modules/mac_timezone.pyt get_date= s c C@ sI t | � } t j | | � } d j | j d � � } t j j j | � S( u� Set the current month, day, and year :param str date: The date to set. Valid date formats are: - %m:%d:%y - %m:%d:%Y - %m/%d/%y - %m/%d/%Y :return: True if successful, False if not :rtype: bool :raises: SaltInvocationError on Invalid Date format :raises: CommandExecutionError on failure CLI Example: .. code-block:: bash salt '*' timezone.set_date 1/13/2016 u systemsetup -setdate {0}u %m:%d:%Y( R R R R t strftimeR R R t execute_return_success( t datet date_formatt dt_objt cmd( ( s= /usr/lib/python2.7/site-packages/salt/modules/mac_timezone.pyt set_dateN s c C@ s( t j j j d � } t j j j | � S( u� Get the current system time. :return: The current time in 24 hour format :rtype: str CLI Example: .. code-block:: bash salt '*' timezone.get_time u systemsetup -gettime( R R R R R ( R ( ( s= /usr/lib/python2.7/site-packages/salt/modules/mac_timezone.pyt get_timel s c C@ sI t | � } t j | | � } d j | j d � � } t j j j | � S( u� Sets the current time. Must be in 24 hour format. :param str time: The time to set in 24 hour format. The value must be double quoted. ie: '"17:46"' :return: True if successful, False if not :rtype: bool :raises: SaltInvocationError on Invalid Time format :raises: CommandExecutionError on failure CLI Example: .. code-block:: bash salt '*' timezone.set_time '"17:34"' u systemsetup -settime {0}u %H:%M:%S( R R R R R R R R R ( t timet time_formatR R ( ( s= /usr/lib/python2.7/site-packages/salt/modules/mac_timezone.pyt set_time} s c C@ s( t j j j d � } t j j j | � S( u� Displays the current time zone :return: The current time zone :rtype: str CLI Example: .. code-block:: bash salt '*' timezone.get_zone u systemsetup -gettimezone( R R R R R ( R ( ( s= /usr/lib/python2.7/site-packages/salt/modules/mac_timezone.pyt get_zone� s c C@ s t j j j d � S( u� Displays the current time zone abbreviated code :return: The current time zone code :rtype: str CLI Example: .. code-block:: bash salt '*' timezone.get_zonecode u date +%Z( R R R R ( ( ( s= /usr/lib/python2.7/site-packages/salt/modules/mac_timezone.pyt get_zonecode� s c C@ s t j j j d � S( u� Displays the current time zone offset :return: The current time zone offset :rtype: str CLI Example: .. code-block:: bash salt '*' timezone.get_offset u date +%z( R R R R ( ( ( s= /usr/lib/python2.7/site-packages/salt/modules/mac_timezone.pyt get_offset� s c C@ sM t j j j d � } t j j j | � } g | j � D] } | j � ^ q7 S( u� Displays a list of available time zones. Use this list when setting a time zone using ``timezone.set_zone`` :return: a list of time zones :rtype: list CLI Example: .. code-block:: bash salt '*' timezone.list_zones u systemsetup -listtimezones( R R R R R t splitlinest strip( R t zonest x( ( s= /usr/lib/python2.7/site-packages/salt/modules/mac_timezone.pyt list_zones� s c C@ sP | t � k r'