ok
Direktori : /opt/cloudlinux/venv/lib64/python3.11/site-packages/clcommon/__pycache__/ |
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/clcommon/__pycache__/sysctl.cpython-311.pyc |
� I/�fp � �z � d dl Z d dlmZ d dlmZmZmZ d dlmZm Z dZ dZ G d� d� � Z G d � d � � Z dS )� N)�ConfigParser)�run_command�get_file_lines�ExternalProgramFailed)�AnyStr�Listz /etc/sysctl.d/90-cloudlinux.confz/etc/sysctl.confc �z � e Zd ZdZdZedfd�Zd� Zed� � � Z d� Z ed� � � Zd � Z d � Zd� Zdd�Zd � ZdS )� SysCtlConfz( For reading params from sysctl z/sbin/sysctlTc �@ � || _ | j � d�| _ || _ dS )z� :param config_file: path to user defined systcl config file :param mute_errors: T/F value to define should we skip errors or not (used in cldiag checker) �.tmpN)�config_file�config_tmp_file�mute_errors)�selfr r s ��/builddir/build/BUILDROOT/alt-python27-cllib-3.4.11-1.el8.cloudlinux.x86_64/opt/cloudlinux/venv/lib/python3.11/site-packages/clcommon/sysctl.py�__init__zSysCtlConf.__init__ s. � � '���"&�"2�8�8�8���&����� c �j � | j dg} t |� � dS # t $ r | j s� Y dS w xY w)z> Apply all params from sysctl.d & sysctl.conf z--systemN)� SYSCTL_BINr r r )r �cmds r � _apply_allzSysCtlConf._apply_all$ sf � � �O�� �� � ��������$� � � ��#� �� � � � ���s � �2�2c �n � | j dd|g}t |d�� � \ }}}|� � � }|S )zM Read sysctl param :param name: name of sysctl param z-bz-nT)r �return_full_output)r r �strip)�cls�namer �ret_code�std_out�std_in�values r �_read_sysctl_paramzSysCtlConf._read_sysctl_param6 sP � � �N���� �� %0��#�% � % � % �!��'�6� � � �����r c �j � t | j dd�� � 5 }d� |� � }|� |� � |� � � t j |� � � � � ddd� � n# 1 swxY w Y t j | j | j � � dS )zm Write sysctl params to sysctl.conf :param lines: content for writing to sysctl.conf �w�utf-8��encoding� N) �openr �join�write�flush�os�fsync�fileno�renamer )r �lines�sysctl_confs r �_write_params_to_filez SysCtlConf._write_params_to_fileL s� � � �$�&��g� >� >� >� +�+��G�G�E�N�N�E����e�$�$�$��������H�[�'�'�)�)�*�*�*� +� +� +� +� +� +� +� +� +� +� +���� +� +� +� +� � �$�&��(8�9�9�9�9�9s �A%B � B �B c �\ � | � d� � d � � � S )N�=r )�splitr )�lines r �_get_param_name_from_linez$SysCtlConf._get_param_name_from_lineY s% � � �z�z�#���q�!�'�'�)�)�)r c �. � t | j � � }|S )zW Read content from sysctl.conf :return: lines from sysctl.conf )r r )r �results r �_read_sysctl_confzSysCtlConf._read_sysctl_conf_ s � � �� 0�1�1��� r c �j � �� � � � � }t �� fd�|D � � � � }|S )Nc 3 �J �K � | ]}��� |� � k V � �d S )N)r7 )�.0r6 � param_namer s ��r � <genexpr>z+SysCtlConf.has_parameter.<locals>.<genexpr>n s6 �� � � �_�_�D�Z�4�#A�#A�$�#G�#G�G�_�_�_�_�_�_r )r: �any)r r>