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__/tuned.cpython-310.pyc
o

�N�gM	�@sLdZddlZddlZddiZdZdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dS)z�
Interface to Red Hat tuned-adm module

:maintainer:    Syed Ali <alicsyed@gmail.com>
:maturity:      new
:depends:       tuned-adm
:platform:      Linux
�N�list_�listZtunedcCstjj�d�}|sdStS)zF
    Check to see if tuned-adm binary is installed on the system

    z	tuned-adm)FzSThe tuned execution module failed to load: the tuned-adm binary is not in the path.)�salt�utils�path�which�__virtualname__)Z	tuned_adm�r	�F/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/tuned.py�__virtual__srcCsbtdd���}|�d�z
|d|�d�d�}Wn	ty#Ynw|��dd�|D�}|S)	zn
    List the profiles available

    CLI Example:

    .. code-block:: bash

        salt '*' tuned.list
    zcmd.runztuned-adm listrNz** COLLECTED WARNINGS **�cSsg|]}|�d�d���qS)z- r)�split�strip)�.0�ir	r	r
�
<listcomp>;szlist_.<locals>.<listcomp>)�__salt__�
splitlines�pop�index�
ValueError��resultr	r	r
r$s
�cCsJtdddd�}|ddkrdSt�d�}t�||d	�}d
�|�d��S)zr
    Return current active profile

    CLI Example:

    .. code-block:: bash

        salt '*' tuned.active
    zcmd.run_allztuned-adm activeT)Zignore_retcode�retcoderZnonez4(?P<stmt>Current active profile:) (?P<profile>\w+.*)�stdoutz{}�profile)r�re�compile�match�format�group)r�patternrr	r	r
�active?s
r"cCs tdd�}t|�dkrdSdS)zg
    Turn off all profiles

    CLI Example:

    .. code-block:: bash

        salt '*' tuned.off
    �cmd.retcodez
tuned-adm offrFT�r�intrr	r	r
�offSsr&cCs(tdd|���}t|�dkrdS|�S)z~
    Activate specified profile

    CLI Example:

    .. code-block:: bash

        salt '*' tuned.profile virtual-guest
    r#ztuned-adm profile rFr$)Zprofile_namerr	r	r
resr)�__doc__rZsalt.utils.pathrZ__func_alias__rrrr"r&rr	r	r	r
�<module>s	�