%PDF- %PDF-
Mini Shell

Mini Shell

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

�
���^c@@s�dZddlmZmZmZddlZddlZddlZddl	m
Z
eje�Z
d�Zeed�Zeeeed�Zdd	�Zdd
�Zdd�Zd�ZdS(
uX
Support for getting and setting the environment variables
of the current salt process.
i(tabsolute_importtprint_functiontunicode_literalsN(tsixcC@stS(uB
    No dependency checks, and not renaming, just return True
    (tTrue(((s8/usr/lib/python2.7/site-packages/salt/modules/environ.pyt__virtual__scC@s�tjjj�}|rBd}d}|dkrBd}d}qBnt|tj�sptjdj	t
|��n|tkr|tkr�y>t
jj|d�|r�|r�td|||�ndSWqtk
r�}tjdj	t
||��tSXqd}nt|tj�r�yB|t
j|<|rM|rMtd	||||�nt
j|SWq�tk
r�}tjd
j	t
||��tSXn tjdj	t
||��tSdS(
u
    Set a single salt process environment variable. Returns True
    on success.

    key
        The environment key to set. Must be a string.

    val
        The value to set. Must be a string or False. Refer to the
        'false_unsets' parameter for behavior when set to False.

    false_unsets
        If val is False and false_unsets is True, then the key will be
        removed from the salt processes environment dict entirely.
        If val is False and false_unsets is not True, then the key's
        value will be set to an empty string.
        Default: False.

    permanent
        On Windows minions this will set the environment variable in the
        registry so that it is always added as an environment variable when
        applications open. If you want to set the variable to HKLM instead of
        HKCU just pass in "HKLM" for this parameter. On all other minion types
        this will be ignored. Note: This will only take affect on applications
        opened after this has been set.

    CLI Example:

    .. code-block:: bash

        salt '*' environ.setval foo bar
        salt '*' environ.setval baz val=False false_unsets=True
        salt '*' environ.setval baz bar permanent=True
        salt '*' environ.setval baz bar permanent=HKLM
    uHKCUuEnvironmentuHKLMu<SYSTEM\CurrentControlSet\Control\Session Manager\Environmentu/{0}: 'key' argument is not a string type: '{1}'ureg.delete_valueu?{0}: Exception occurred when unsetting environ key '{1}': '{2}'uu
reg.set_valueu<{0}: Exception occurred when settingenviron key '{1}': '{2}'uA{0}: 'val' argument for key '{1}' is not a string or False: '{2}'N(tsalttutilstplatformt
is_windowst
isinstanceRtstring_typestlogtdebugtformatt__name__tFalseRtostenvirontpoptNonet__salt__t	Exceptionterror(tkeytvaltfalse_unsetst	permanentR	tpermanent_hivet
permanent_keytexc((s8/usr/lib/python2.7/site-packages/salt/modules/environ.pytsetvalsN$	
c	C@soi}t|t�s2tjdjt|��tS|tkr�gtj	D]}||krH|^qH}x-|D]"}t
|t|d|�||<qmWnx�tj|�D]�\}}t|tj
�r�t
||d|�||<q�|tkrt
|||d|�||<q�tjdjt||��tSq�W|tkrktdi|d6|d6|d6|d6d	�n|S(
u�
    Set multiple salt process environment variables from a dict.
    Returns a dict.

    environ
        Must be a dict. The top-level keys of the dict are the names
        of the environment variables to set. Each key's value must be
        a string or False. Refer to the 'false_unsets' parameter for
        behavior when a value set to False.

    false_unsets
        If a key's value is False and false_unsets is True, then the
        key will be removed from the salt processes environment dict
        entirely. If a key's value is False and false_unsets is not
        True, then the key's value will be set to an empty string.
        Default: False

    clear_all
        USE WITH CAUTION! This option can unset environment variables
        needed for salt to function properly.
        If clear_all is True, then any environment variables not
        defined in the environ dict will be deleted.
        Default: False

    update_minion
        If True, apply these environ changes to the main salt-minion
        process. If False, the environ changes will only affect the
        current salt subprocess.
        Default: False

    permanent
        On Windows minions this will set the environment variable in the
        registry so that it is always added as an environment variable when
        applications open. If you want to set the variable to HKLM instead of
        HKCU just pass in "HKLM" for this parameter. On all other minion types
        this will be ignored. Note: This will only take affect on applications
        opened after this has been set.


    CLI Example:

    .. code-block:: bash

        salt '*' environ.setenv '{"foo": "bar", "baz": "quux"}'
        salt '*' environ.setenv '{"a": "b", "c": False}' false_unsets=True
    u,{0}: 'environ' argument is not a dict: '{1}'RuA{0}: 'val' argument for key '{1}' is not a string or False: '{2}'u
event.fireuenvironufalse_unsetsu	clear_allu	permanentuenviron_setenv(R
tdictRR
RRRRRRRRt	iteritemsRR(	RRt	clear_allt
update_minionRtretRtto_unsetR((s8/usr/lib/python2.7/site-packages/salt/modules/environ.pytsetenvrs4/
(
#
ucC@sBt|tj�s/tjdjt|��tStj	j
||�S(u_
    Get a single salt process environment variable.

    key
        String used as the key for environment lookup.

    default
        If the key is not found in the environment, return this value.
        Default: ''


    CLI Example:

    .. code-block:: bash

        salt '*' environ.get foo
        salt '*' environ.get baz default=False
    u/{0}: 'key' argument is not a string type: '{1}'(R
RRRR
RRRRRtget(Rtdefault((s8/usr/lib/python2.7/site-packages/salt/modules/environ.pyR'�s
cC@s|t|tj�s/tjdjt|��tSy4tj	|}|dk	rb||kr[tStSnWntk
rwtSXtS(u�
    Determine whether the key exists in the current salt process
    environment dictionary. Optionally compare the current value
    of the environment against the supplied value string.

    key
        Must be a string. Used as key for environment lookup.

    value:
        Optional. If key exists in the environment, compare the
        current value with this value. Return True if they are equal.

    CLI Example:

    .. code-block:: bash

        salt '*' environ.has_value foo
    u/{0}: 'key' argument is not a string type: '{1}'N(
R
RRRR
RRRRRRRtKeyError(Rtvaluetcur_val((s8/usr/lib/python2.7/site-packages/salt/modules/environ.pyt	has_value�s


cC@s�i}g}t|tj�r.|j|�n1t|t�rF|}ntjdjt|��x'|D]}t	j
j||�||<qfW|S(u�
    Get one or more salt process environment variables.
    Returns a dict.

    keys
        Either a string or a list of strings that will be used as the
        keys for environment lookup.

    default
        If the key is not found in the environment, return this value.
        Default: ''

    CLI Example:

    .. code-block:: bash

        salt '*' environ.item foo
        salt '*' environ.item '[foo, baz]' default=None
    u8{0}: 'keys' argument is not a string or list type: '{1}'(R
RRtappendtlistRR
RRRRR'(tkeysR(R$tkey_listR((s8/usr/lib/python2.7/site-packages/salt/modules/environ.pytitems	

cC@s
ttj�S(u�
    Return a dict of the entire environment set for the salt process

    CLI Example:

    .. code-block:: bash

        salt '*' environ.items
    (R RR(((s8/usr/lib/python2.7/site-packages/salt/modules/environ.pytitems)s
(t__doc__t
__future__RRRRtloggingtsalt.utils.platformRtsalt.extRt	getLoggerRRRRRR&R'RR,R1R2(((s8/usr/lib/python2.7/site-packages/salt/modules/environ.pyt<module>s	WR%$

Zerion Mini Shell 1.0