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/modules/__pycache__/layman.cpython-310.pyc
o

�N�g��@sRdZddlZddlZdd�Zdd�Zdd�Zd	d
�Zddd
�Zdd�Z	dd�Z
dS)z
Support for Layman
�NcCs"tddkrtjj�d�rdSdS)z;
    Only work on Gentoo systems with layman installed
    �osZGentoo�layman)FzYlayman execution module cannot be loaded: only available on Gentoo with layman installed.)Z
__grains__�salt�utils�path�which�rr�G/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/layman.py�__virtual__	sr
cCs,d}d}td|�r|Std|�r|SdS)z�
    Find the correct make.conf. Gentoo recently moved the make.conf
    but still supports the old location, using the old location first
    z/etc/make.confz/etc/portage/make.confzfile.file_existsN��__salt__)Zold_confZnew_confrrr	�
_get_makeconfs�r
cs�t�}t��d|��}td|ddd�}|ddkr"tj�|d��t�}�s<|r<d	}t�}td
|d�s<td||��fd
d�|D�}|S)a'
    Add the given overlay from the cached remote list to your locally
    installed overlays. Specify 'ALL' to add all overlays from the
    remote list.

    Return a list of the new overlay(s) added:

    CLI Example:

    .. code-block:: bash

        salt '*' layman.add <overlay name>
    zlayman --quietness=0 --add �cmd.run_allF�y)�python_shell�stdin�retcoder�stdout� source /var/lib/layman/make.conf�
file.containsrzfile.appendc�g|]}|�vr|�qSrr��.0�overlay��old_overlaysrr	�
<listcomp>B�zadd.<locals>.<listcomp>��list�
list_localrr�
exceptionsZCommandExecutionErrorr
)r�ret�cmdZadd_attempt�new_overlays�srcline�makeconfrrr	�add#s
r'cs�t�}t�}d|��}td|dd�}|ddkr!tj�|d��t���s:d}t�}td	|d
�r:td||d��fd
d�|D�}|S)a

    Remove the given overlay from the your locally installed overlays.
    Specify 'ALL' to remove all overlays.

    Return a list of the overlays(s) that were removed:

    CLI Example:

    .. code-block:: bash

        salt '*' layman.delete <overlay name>
    zlayman --quietness=0 --delete rF�rrrrrrrzfile.sed�crrrr�r$rr	rcrzdelete.<locals>.<listcomp>r)rr"rr#Zdelete_attemptr%r&rr*r	�deleteFs

r+�ALLcCsd|��}td|dd�dkS)a
    Update the specified overlay. Use 'ALL' to synchronize all overlays.
    This is the default if no overlay is specified.

    overlay
        Name of the overlay to sync. (Defaults to 'ALL')

    CLI Example:

    .. code-block:: bash

        salt '*' layman.sync
    zlayman --quietness=0 --sync zcmd.retcodeFr(rr)rr#rrr	�syncgs
r-cC�,d}td|dd��d�}dd�|D�}|S)z�
    List the locally installed overlays.

    Return a list of installed overlays:

    CLI Example:

    .. code-block:: bash

        salt '*' layman.list_local
    z+layman --quietness=1 --list-local --nocolor�cmd.runFr(�
cS�(g|]}t|���dkr|��d�qS�����len�split�r�linerrr	r��(zlist_local.<locals>.<listcomp>�rr7�r#�outr"rrr	r y�r cCr.)z�
    List all overlays, including remote ones.

    Return a list of available overlays:

    CLI Example:

    .. code-block:: bash

        salt '*' layman.list_all
    z%layman --quietness=1 --list --nocolorr/Fr(r0cSr1r2r5r8rrr	r�r:zlist_all.<locals>.<listcomp>r;r<rrr	�list_all�r>r?)r,)�__doc__Zsalt.exceptionsrZsalt.utils.pathr
r
r'r+r-r r?rrrr	�<module>s

#
!