HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.29
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/eselect.cpython-310.pyc
o

�N�g��@s\dZddlZddlZe�e�Zdd�Z	ddd�Zdd	�Z	dd
d�Z
ddd
�Zddd�ZdS)zB
Support for eselect, Gentoo's configuration and management tool.
�NcCs"tddkrtjj�d�rdSdS)z<
    Only work on Gentoo systems with eselect installed
    �osZGentooZeselect)FzxThe eselect execution module cannot be loaded: either the system is not Gentoo or the eselect binary is not in the path.)Z
__grains__�salt�utils�path�which�rr�H/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/eselect.py�__virtual__sr	FcCsttdd�||p	d||p
d�dd�}|���d�}|d�d�r"dS|r&d	S|s*dSt|�d
kr8|d��s8dS|S)aM
    Execute an arbitrary action on a module.

    module
        name of the module to be executed

    action
        name of the module's action to be run

    module_parameter
        additional params passed to the defined module

    action_parameter
        additional params passed to the defined action

    state_only
        don't return any output but only the success/failure of the operation

    CLI Example (updating the ``php`` implementation used for ``apache2``):

    .. code-block:: bash

        salt '*' eselect.exec_action php update action_parameter='apache2'
    zcmd.runz'eselect --brief --colour=no {} {} {} {}�F)Zpython_shell�
rz	!!! ErrorT�)Z__salt__�format�strip�split�
startswith�len)�module�action�module_parameter�action_parameter�
state_only�outrrr�exec_actions ��rcCs:g}tdddd�}|s
dS|D]}|dvr|�|�q|S)z
    List available ``eselect`` modules.

    CLI Example:

    .. code-block:: bash

        salt '*' eselect.get_modules
    �modules�listz--only-names�rN)�help�usage�version)r�append)rZmodule_listrrrr�get_modulesKs

�r cCsLt|d|d�}|sdSg}t|t�r$|D]
}|�|�dd�d�q|SdS)aJ
    List available targets for the given module.

    module
        name of the module to be queried for its targets

    action_parameter
        additional params passed to the defined action

        .. versionadded:: 2016.11.0

    CLI Example:

    .. code-block:: bash

        salt '*' eselect.get_target_list kernel
    rrNrr)r�
isinstancerrr)rrZexec_outputZtarget_list�itemrrr�get_target_list`s
r#cCs,t|d||d�d}|sdS|dkrdS|S)aT
    Get the currently selected target for the given module.

    module
        name of the module to be queried for its current target

    module_parameter
        additional params passed to the defined module

    action_parameter
        additional params passed to the 'show' action

    CLI Example (current target of system-wide ``java-vm``):

    .. code-block:: bash

        salt '*' eselect.get_current_target java-vm action_parameter='system'

    CLI Example (current target of ``kernel`` symlink):

    .. code-block:: bash

        salt '*' eselect.get_current_target kernel
    Zshow)rrrNz(unset))r)rrr�resultrrr�get_current_targets��r%cCsP|r
|�d|��}n|}|t�vrt�d|�dSt|d||dd�}|r&|SdS)a�
    Set the target for the given module.
    Target can be specified by index or name.

    module
        name of the module for which a target should be set

    target
        name of the target to be set for this module

    module_parameter
        additional params passed to the defined module

    action_parameter
        additional params passed to the defined action

    CLI Example (setting target of system-wide ``java-vm``):

    .. code-block:: bash

        salt '*' eselect.set_target java-vm icedtea-bin-7 action_parameter='system'

    CLI Example (setting target of ``kernel`` symlink):

    .. code-block:: bash

        salt '*' eselect.set_target kernel linux-3.17.5-gentoo
    � zModule %s not availableF�setT)rrr)r �log�errorr)r�targetrrZexec_resultrrr�
set_target�s 
�r+)NNF)N)NN)
�__doc__�loggingZsalt.utils.pathr�	getLogger�__name__r(r	rr r#r%r+rrrr�<module>s

�2

(