%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/win_powercfg.pyc

�
���^c@@s�dZddlmZmZmZddlZddlZddlZej	e
�ZdZd�Z
d�Zd�Zd�Zd	dd
�Zdd�Zd	dd�Zdd
�Zd	dd�Zdd�Zd	dd�Zdd�ZdS(u[
This module allows you to control the power settings of a windows minion via
powercfg.

.. versionadded:: 2015.8.0

.. code-block:: bash

    # Set monitor to never turn off on Battery power
    salt '*' powercfg.set_monitor_timeout 0 power=dc
    # Set disk timeout to 120 minutes on AC power
    salt '*' powercfg.set_disk_timeout 120 power=ac
i(tabsolute_importtunicode_literalstprint_functionNupowercfgcC@s tjjj�stdfStS(u
    Only work on Windows
    u&PowerCFG: Module only works on Windows(tsalttutilstplatformt
is_windowstFalset__virtualname__(((s=/usr/lib/python2.7/site-packages/salt/modules/win_powercfg.pyt__virtual__s
cC@sBd}td|dt�}tjd|�}|j�dj�S(Nupowercfg /getactiveschemeucmd.runtpython_shellu
GUID: (.*) \(i(t__salt__Rtretsearchtgroupststrip(tcmdtouttmatches((s=/usr/lib/python2.7/site-packages/salt/modules/win_powercfg.pyt_get_current_scheme%sc	C@s|dkrt�}ntddkr=dj||�}ndj|||�}td|dt�}|jd�}t|�dkr�x=|D](}||ks�||kr�|}Pq�q�Wn
|d	}tj	d
|�}it
|d	d	�dd6t
|dd	�dd
6S(u_
    Returns the AC/DC values in an dict for a guid and subguid for a the given
    scheme
    u	osreleaseu7upowercfg /q {0} {1}upowercfg /q {0} {1} {2}ucmd.runR
u

iiu!Power Setting Index: ([0-9a-fx]+)i<uacudcN(tNoneRt
__grains__tformatRRtsplittlenRtfindalltint(	tschemetguidtsubguidt	safe_nameRRRtstraw_settings((s=/usr/lib/python2.7/site-packages/salt/modules/win_powercfg.pyt_get_powercfg_minute_values,s 

cC@sQ|dkrt�}ndj|||||d�}td|dt�dkS(uV
    Sets the AC/DC values of a setting with the given power for the given scheme
    u*powercfg /set{0}valueindex {1} {2} {3} {4}i<ucmd.retcodeR
iN(RRRRR(Rt	sub_grouptsetting_guidtpowertvalueR((s=/usr/lib/python2.7/site-packages/salt/modules/win_powercfg.pyt_set_powercfg_valueHs
uaccC@s%td|ddddd|d|�S(u�
    Set the monitor timeout in minutes for the given power scheme

    Args:
        timeout (int):
            The amount of time in minutes before the monitor will timeout

        power (str):
            Set the value for AC or DC power. Default is ``ac``. Valid options
            are:

                - ``ac`` (AC Power)
                - ``dc`` (Battery)

        scheme (str):
            The scheme to use, leave as ``None`` to use the current. Default is
            ``None``. This can be the GUID or the Alias for the Scheme. Known
            Aliases are:

                - ``SCHEME_BALANCED`` - Balanced
                - ``SCHEME_MAX`` - Power saver
                - ``SCHEME_MIN`` - High performance

    Returns:
        bool: ``True`` if successful, otherwise ``False``

    CLI Example:

    .. code-block:: bash

        # Sets the monitor timeout to 30 minutes
        salt '*' powercfg.set_monitor_timeout 30
    RR"u	SUB_VIDEOR#u	VIDEOIDLER$R%(R&(ttimeoutR$R((s=/usr/lib/python2.7/site-packages/salt/modules/win_powercfg.pytset_monitor_timeoutTs"c	C@std|dddddd�S(uM
    Get the current monitor timeout of the given scheme

    Args:
        scheme (str):
            The scheme to use, leave as ``None`` to use the current. Default is
            ``None``. This can be the GUID or the Alias for the Scheme. Known
            Aliases are:

                - ``SCHEME_BALANCED`` - Balanced
                - ``SCHEME_MAX`` - Power saver
                - ``SCHEME_MIN`` - High performance

    Returns:
        dict: A dictionary of both the AC and DC settings

    CLI Example:

    .. code-block:: bash

        salt '*' powercfg.get_monitor_timeout
    RRu	SUB_VIDEORu	VIDEOIDLERuTurn off display after(R!(R((s=/usr/lib/python2.7/site-packages/salt/modules/win_powercfg.pytget_monitor_timeout~s
cC@s%td|ddddd|d|�S(u�
    Set the disk timeout in minutes for the given power scheme

    Args:
        timeout (int):
            The amount of time in minutes before the disk will timeout

        power (str):
            Set the value for AC or DC power. Default is ``ac``. Valid options
            are:

                - ``ac`` (AC Power)
                - ``dc`` (Battery)

        scheme (str):
            The scheme to use, leave as ``None`` to use the current. Default is
            ``None``. This can be the GUID or the Alias for the Scheme. Known
            Aliases are:

                - ``SCHEME_BALANCED`` - Balanced
                - ``SCHEME_MAX`` - Power saver
                - ``SCHEME_MIN`` - High performance

    Returns:
        bool: ``True`` if successful, otherwise ``False``

    CLI Example:

    .. code-block:: bash

        # Sets the disk timeout to 30 minutes on battery
        salt '*' powercfg.set_disk_timeout 30 power=dc
    RR"uSUB_DISKR#uDISKIDLER$R%(R&(R'R$R((s=/usr/lib/python2.7/site-packages/salt/modules/win_powercfg.pytset_disk_timeout�s"c	C@std|dddddd�S(uG
    Get the current disk timeout of the given scheme

    Args:
        scheme (str):
            The scheme to use, leave as ``None`` to use the current. Default is
            ``None``. This can be the GUID or the Alias for the Scheme. Known
            Aliases are:

                - ``SCHEME_BALANCED`` - Balanced
                - ``SCHEME_MAX`` - Power saver
                - ``SCHEME_MIN`` - High performance

    Returns:
        dict: A dictionary of both the AC and DC settings

    CLI Example:

    .. code-block:: bash

        salt '*' powercfg.get_disk_timeout
    RRuSUB_DISKRuDISKIDLERuTurn off hard disk after(R!(R((s=/usr/lib/python2.7/site-packages/salt/modules/win_powercfg.pytget_disk_timeout�s
cC@s%td|ddddd|d|�S(u�
    Set the standby timeout in minutes for the given power scheme

    Args:
        timeout (int):
            The amount of time in minutes before the computer sleeps

        power (str):
            Set the value for AC or DC power. Default is ``ac``. Valid options
            are:

                - ``ac`` (AC Power)
                - ``dc`` (Battery)

        scheme (str):
            The scheme to use, leave as ``None`` to use the current. Default is
            ``None``. This can be the GUID or the Alias for the Scheme. Known
            Aliases are:

                - ``SCHEME_BALANCED`` - Balanced
                - ``SCHEME_MAX`` - Power saver
                - ``SCHEME_MIN`` - High performance

    Returns:
        bool: ``True`` if successful, otherwise ``False``

    CLI Example:

    .. code-block:: bash

        # Sets the system standby timeout to 30 minutes on Battery
        salt '*' powercfg.set_standby_timeout 30 power=dc
    RR"u	SUB_SLEEPR#uSTANDBYIDLER$R%(R&(R'R$R((s=/usr/lib/python2.7/site-packages/salt/modules/win_powercfg.pytset_standby_timeout�s"c	C@std|dddddd�S(uC
    Get the current standby timeout of the given scheme

        scheme (str):
            The scheme to use, leave as ``None`` to use the current. Default is
            ``None``. This can be the GUID or the Alias for the Scheme. Known
            Aliases are:

                - ``SCHEME_BALANCED`` - Balanced
                - ``SCHEME_MAX`` - Power saver
                - ``SCHEME_MIN`` - High performance

    Returns:
        dict: A dictionary of both the AC and DC settings

    CLI Example:

    .. code-block:: bash

        salt '*' powercfg.get_standby_timeout
    RRu	SUB_SLEEPRuSTANDBYIDLERuSleep after(R!(R((s=/usr/lib/python2.7/site-packages/salt/modules/win_powercfg.pytget_standby_timeouts
cC@s%td|ddddd|d|�S(u�
    Set the hibernate timeout in minutes for the given power scheme

    Args:
        timeout (int):
            The amount of time in minutes before the computer hibernates

        power (str):
            Set the value for AC or DC power. Default is ``ac``. Valid options
            are:

                - ``ac`` (AC Power)
                - ``dc`` (Battery)

        scheme (str):
            The scheme to use, leave as ``None`` to use the current. Default is
            ``None``. This can be the GUID or the Alias for the Scheme. Known
            Aliases are:

                - ``SCHEME_BALANCED`` - Balanced
                - ``SCHEME_MAX`` - Power saver
                - ``SCHEME_MIN`` - High performance

    Returns:
        bool: ``True`` if successful, otherwise ``False``

    CLI Example:

    .. code-block:: bash

        # Sets the hibernate timeout to 30 minutes on Battery
        salt '*' powercfg.set_hibernate_timeout 30 power=dc
    RR"u	SUB_SLEEPR#u
HIBERNATEIDLER$R%(R&(R'R$R((s=/usr/lib/python2.7/site-packages/salt/modules/win_powercfg.pytset_hibernate_timeout+s"c	C@std|dddddd�S(uG
    Get the current hibernate timeout of the given scheme

        scheme (str):
            The scheme to use, leave as ``None`` to use the current. Default is
            ``None``. This can be the GUID or the Alias for the Scheme. Known
            Aliases are:

                - ``SCHEME_BALANCED`` - Balanced
                - ``SCHEME_MAX`` - Power saver
                - ``SCHEME_MIN`` - High performance

    Returns:
        dict: A dictionary of both the AC and DC settings

    CLI Example:

    .. code-block:: bash

        salt '*' powercfg.get_hibernate_timeout
    RRu	SUB_SLEEPRu
HIBERNATEIDLERuHibernate after(R!(R((s=/usr/lib/python2.7/site-packages/salt/modules/win_powercfg.pytget_hibernate_timeoutUs
(t__doc__t
__future__RRRRtloggingtsalt.utils.platformRt	getLoggert__name__tlogRR	RR!R&RR(R)R*R+R,R-R.R/(((s=/usr/lib/python2.7/site-packages/salt/modules/win_powercfg.pyt<module>s$					****

Zerion Mini Shell 1.0