File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/tuned.cpython-310.pyc
Back
o ;jM � @ sL d Z ddlZddlZddiZdZdd� 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_�listZtunedc C s t jj�d�} | sdS tS )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__ s r c C sb t d d��� } | �d� z | d| �d�d � } W n ty# Y nw | �� dd� | D �} | S ) zn List the profiles available CLI Example: .. code-block:: bash salt '*' tuned.list zcmd.runztuned-adm listr Nz** COLLECTED WARNINGS **� c S s g | ]}|� d �d �� �qS )z- r )�split�strip)�.0�ir r r � <listcomp>; s zlist_.<locals>.<listcomp>)�__salt__� splitlines�pop�index� ValueError��resultr r r r $ s �c C sJ t d ddd�} | d dkrdS t�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�retcoder �nonez4(?P<stmt>Current active profile:) (?P<profile>\w+.*)�stdoutz{}�profile)r �re�compile�match�format�group)r �patternr r r r �active? s r# c C s t d d�} t| �dkrdS dS )zg Turn off all profiles CLI Example: .. code-block:: bash salt '*' tuned.off �cmd.retcodez tuned-adm offr FT�r �intr r r r �offS s r'