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

�N�gD�@s.dZddlZddlmZdd�Zddd�ZdS)	z�
Configuration of the kernel using sysctl
========================================

Control the kernel sysctl system.

.. code-block:: yaml

  vm.swappiness:
    sysctl.present:
      - value: 20
�N)�CommandExecutionErrorcCsdtvrdSdS)zF
    This state is only available on Minions which support sysctl
    �sysctl.showT)Fz!sysctl module could not be loaded)�__salt__�rr�F/opt/saltstack/salt/lib/python3.10/site-packages/salt/states/sysctl.py�__virtual__src
Cs|didd�}|durdtvrtd�}nd}tdr�td|d	�}|dur4d|d
<d�||�|d<|Std
|�}|r�||vrYt|���|��krXd|d
<d�||�|d<|Sn@t�dd|�t�ddt|��krwd|d
<d�||�|d<|Sd|d
<d�||�|d<|S|s�||vr�d|d
<d�||�|d<|Sd|d
<d|�d|��|d<|Sz
td|||�}Wn%ty�}zd|d
<d|�d|�d|��|d<|WYd}~Sd}~ww|dkr�||i|d<d|�d|��|d<|S|dkr�d |�d|�d!�|d<|S)"a�
    Ensure that the named sysctl value is set in memory and persisted to the
    named configuration file. The default sysctl configuration file is
    /etc/sysctl.conf

    name
        The name of the sysctl value to edit

    value
        The sysctl value to apply. Make sure to set the value to the correct expected
        output for systctl or reading the respective /proc/sys file. For example, instead
        of adding the value `1,2,3` you might need to write `1-3`. If you do not set
        the correct value, Salt will continue to return with changes.

    config
        The location of the sysctl configuration file. If not specified, the
        proper location will be detected based on platform.
    T�)�name�result�changes�commentNzsysctl.default_configz/etc/sysctl.conf�testr)Zconfig_filer
zsSysctl option {} might be changed, we failed to check config file at {}. The file is either unreadable, or missing.rz
sysctl.getz#Sysctl value {} = {} is already setz +|	+� z(Sysctl option {} set to be changed to {}z�Sysctl value is currently set on the running system but not in a config file. Sysctl option {} set to be changed to {} in config file.z�Sysctl value {0} is present in configuration file but is not present in the running config. The value {0} is set to be changed to {1}zSysctl option z would be changed to zsysctl.persistFzFailed to set z to z: ZUpdatedrzUpdated sysctl value z = zAlready setz
Sysctl value z is already set)rZ__opts__�format�str�split�re�subr)r	�valueZconfig�retZ
configured�current�update�excrrr�presentst��� ������r)N)�__doc__rZsalt.exceptionsrrrrrrr�<module>s