%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python2.7/site-packages/salt/modules/
Upload File :
Create Path :
Current File : //lib/python2.7/site-packages/salt/modules/mac_timezone.pyc

�
���^c@@s	dZddlmZmZmZddlmZddlZddlZddl	m
Z
dZd�Zd�Z
d	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zdd�Zd�Zd�ZdS(uM
Module for editing date/time settings on macOS

 .. versionadded:: 2016.3.0
i(tabsolute_importtunicode_literalstprint_function(tdatetimeN(tSaltInvocationErrorutimezonecC@s tjjj�stdfStS(u
    Only for macOS
    uPThe mac_timezone module could not be loaded: module only works on macOS systems.(tsalttutilstplatformt	is_darwintFalset__virtualname__(((s=/usr/lib/python2.7/site-packages/salt/modules/mac_timezone.pyt__virtual__s
cC@swddddddg}x=|D]5}ytj||�|SWqtk
rSqqXqWdj|�}t|��dS(	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/%YuInvalid Date/Time Format: {0}N(Rtstrptimet
ValueErrortformatR(t	dt_stringt
valid_formatst	dt_formattmsg((s=/usr/lib/python2.7/site-packages/salt/modules/mac_timezone.pyt_get_date_time_formats
	

cC@s(tjjjd�}tjjj|�S(u�
    Displays the current date

    :return: the system date
    :rtype: str

    CLI Example:

    .. code-block:: bash

        salt '*' timezone.get_date
    usystemsetup -getdate(RRt	mac_utilstexecute_return_resulttparse_return(tret((s=/usr/lib/python2.7/site-packages/salt/modules/mac_timezone.pytget_date=s
cC@sIt|�}tj||�}dj|jd��}tjjj|�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
    usystemsetup -setdate {0}u%m:%d:%Y(	RRRRtstrftimeRRRtexecute_return_success(tdatetdate_formattdt_objtcmd((s=/usr/lib/python2.7/site-packages/salt/modules/mac_timezone.pytset_dateNscC@s(tjjjd�}tjjj|�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
    usystemsetup -gettime(RRRRR(R((s=/usr/lib/python2.7/site-packages/salt/modules/mac_timezone.pytget_timels
cC@sIt|�}tj||�}dj|jd��}tjjj|�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"'
    usystemsetup -settime {0}u%H:%M:%S(	RRRRRRRRR(ttimettime_formatRR((s=/usr/lib/python2.7/site-packages/salt/modules/mac_timezone.pytset_time}scC@s(tjjjd�}tjjj|�S(u�
    Displays the current time zone

    :return: The current time zone
    :rtype: str

    CLI Example:

    .. code-block:: bash

        salt '*' timezone.get_zone
    usystemsetup -gettimezone(RRRRR(R((s=/usr/lib/python2.7/site-packages/salt/modules/mac_timezone.pytget_zone�s
cC@stjjjd�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
    udate +%Z(RRRR(((s=/usr/lib/python2.7/site-packages/salt/modules/mac_timezone.pytget_zonecode�s
cC@stjjjd�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
    udate +%z(RRRR(((s=/usr/lib/python2.7/site-packages/salt/modules/mac_timezone.pyt
get_offset�s
cC@sMtjjjd�}tjjj|�}g|j�D]}|j�^q7S(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
    usystemsetup -listtimezones(RRRRRt
splitlineststrip(Rtzonestx((s=/usr/lib/python2.7/site-packages/salt/modules/mac_timezone.pyt
list_zones�s	cC@sP|t�kr'tdj|���ntjjjdj|��|t�kS(u�
    Set the local time zone. Use ``timezone.list_zones`` to list valid time_zone
    arguments

    :param str time_zone: The time zone to apply

    :return: True if successful, False if not
    :rtype: bool

    :raises: SaltInvocationError on Invalid Timezone
    :raises: CommandExecutionError on failure

    CLI Example:

    .. code-block:: bash

        salt '*' timezone.set_zone America/Denver
    uInvalid Timezone: {0}usystemsetup -settimezone {0}(R+RRRRRRR$(t	time_zone((s=/usr/lib/python2.7/site-packages/salt/modules/mac_timezone.pytset_zone�s
cC@s
|t�kS(u�
    Compares the given timezone name with the system timezone name.

    :return: True if they are the same, False if not
    :rtype: bool

    CLI Example:

    .. code-block:: bash

        salt '*' timezone.zone_compare America/Boise
    (R$(R,((s=/usr/lib/python2.7/site-packages/salt/modules/mac_timezone.pytzone_compare�s
cC@s=tjjjd�}tjjjtjjj|��dkS(u�
    Display whether network time is on or off

    :return: True if network time is on, False if off
    :rtype: bool

    CLI Example:

    .. code-block:: bash

        salt '*' timezone.get_using_network_time
    u systemsetup -getusingnetworktimeuon(RRRRtvalidate_enabledR(R((s=/usr/lib/python2.7/site-packages/salt/modules/mac_timezone.pytget_using_network_time
s
	cC@sStjjj|�}dj|�}tjjj|�|tjjjt��kS(ug
    Set whether network time is on or off.

    :param enable: True to enable, False to disable. Can also use 'on' or 'off'
    :type: str bool

    :return: True if successful, False if not
    :rtype: bool

    :raises: CommandExecutionError on failure

    CLI Example:

    .. code-block:: bash

        salt '*' timezone.set_using_network_time True
    u$systemsetup -setusingnetworktime {0}(RRRR/RRR0(tenabletstateR((s=/usr/lib/python2.7/site-packages/salt/modules/mac_timezone.pytset_using_network_times
cC@s(tjjjd�}tjjj|�S(u�
    Display the currently set network time server.

    :return: the network time server
    :rtype: str

    CLI Example:

    .. code-block:: bash

        salt '*' timezone.get_time_server
    u!systemsetup -getnetworktimeserver(RRRRR(R((s=/usr/lib/python2.7/site-packages/salt/modules/mac_timezone.pytget_time_server9s
	utime.apple.comcC@s/dj|�}tjjj|�|t�kS(u�
    Designates a network time server. Enter the IP address or DNS name for the
    network time server.

    :param time_server: IP or DNS name of the network time server. If nothing
        is passed the time server will be set to the macOS default of
        'time.apple.com'
    :type: str

    :return: True if successful, False if not
    :rtype: bool

    :raises: CommandExecutionError on failure

    CLI Example:

    .. code-block:: bash

        salt '*' timezone.set_time_server time.acme.com
    u%systemsetup -setnetworktimeserver {0}(RRRRRR4(ttime_serverR((s=/usr/lib/python2.7/site-packages/salt/modules/mac_timezone.pytset_time_serverKscC@stS(u�
    Get current hardware clock setting (UTC or localtime)

    CLI Example:

    .. code-block:: bash

        salt '*' timezone.get_hwclock
    (R	(((s=/usr/lib/python2.7/site-packages/salt/modules/mac_timezone.pytget_hwclockfscC@stS(u�
    Sets the hardware clock to be either UTC or localtime

    CLI Example:

    .. code-block:: bash

        salt '*' timezone.set_hwclock UTC
    (R	(tclock((s=/usr/lib/python2.7/site-packages/salt/modules/mac_timezone.pytset_hwclockts(t__doc__t
__future__RRRRtsalt.utils.mac_utilsRtsalt.utils.platformtsalt.exceptionsRR
RRRRR R#R$R%R&R+R-R.R0R3R4R6R7R9(((s=/usr/lib/python2.7/site-packages/salt/modules/mac_timezone.pyt<module>s0																

Zerion Mini Shell 1.0