HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/states/__pycache__/environ.cpython-310.pyc
o

�N�gw�@s:dZddlZddlZdd�Zdd�Z				d
dd	�ZdS)zX
Support for getting and setting the environment variables
of the current salt process.
�NcCsdS)zB
    No dependency checks, and not renaming, just return True
    T�rrr�G/opt/saltstack/salt/lib/python3.10/site-packages/salt/states/environ.py�__virtual__srcCstjj��r
|��S|S)z,
    Normalize windows environment keys
    )�salt�utils�platform�
is_windows�upper)�keyrrr�	_norm_keysrFc
s|iddd�}i�t|t�s|dur|�|<nt|t�r|�n
d|d<d|d<|S|durS�fdd	�tjD�}|D]�|durI|d
��di�q9|d
��di�q9ttj�}g}	���D]e\�}
|
dur���fdd
�}|�t��d�dur�|�s�|dur�|d
��di�q^|dur�|�t��d�dkr�|d
��di�q^|d
��di�q^|�t��d�|
kr�|	�	��q^|d
��|
i�q^t
dr�|d
r�d|d<|Sd|d<|S|d
�rtd�|||��}|s�d|d<d|d<|Sd|d<||d
<d|d<|Sd|d<|S)ay
    Set the salt process environment variables.

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

    value
        Either a string or dict. When string, it will be the value
        set for the environment key of 'name' above.
        When a dict, each key/value pair represents an environment
        variable to set.

    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 a 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.

    Example:

    .. code-block:: yaml

        a_string_env:
           environ.setenv:
             - name: foo
             - value: bar
             - update_minion: True

        a_dict_env:
           environ.setenv:
             - name: does_not_matter
             - value:
                 foo: bar
                 baz: quux
    T�)�name�changes�result�commentFrz+Environ value must be string, dict or Falsercsg|]}|�vr|�qSrr)�.0r
)�environrr�
<listcomp>jszsetenv.<locals>.<listcomp>rNcsHtjj��r"d}d}�dkrd}d}td||t���}|dduSdS)	NZHKCUZEnvironmentZHKLMz<SYSTEM\CurrentControlSet\Control\Session Manager\Environmentzreg.read_value�successTF)rrrrZ	__utils__r)Zpermanent_hiveZ
permanent_key�out)r
�	permanentrr�
key_existszs�
�zsetenv.<locals>.key_exists�testzEnviron values will be changedz6Environ values are already set with the correct valueszenviron.setenvzFailed to set environ variableszEnviron values were setz7Environ values were already set with the correct values)�
isinstance�str�dict�osr�update�items�getr�appendZ__opts__Z__salt__)
r
�valueZfalse_unsetsZ	clear_allZ
update_minionr�retZto_unsetZcurrent_environZalready_set�valrZenviron_retr)rr
rr�setenvshB


���

��r$)FFFF)�__doc__rZsalt.utils.platformrrrr$rrrr�<module>s�