File: //opt/imunify360/venv/lib64/python3.11/site-packages/clcommon/__pycache__/utils.cpython-311.pyc
�
뭸���
� � d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl Z d dl
Z
d dl mZmZ d dl
mZ d dlmZmZmZmZmZmZ d dlZd dlZd dlmc mZ d dlmZmZmZmZ dZ dZ!dZ"d Z#d
Z$d� Z%dQd�Z&d
� Z'd� Z(d� Z)d� Z* dRd�Z+d� Z,dee- fd�Z.d� Z/de0fd�Z1de-dz fd�Z2de-dz fd�Z3edee- fd�� � Z4de5fd�Z6de-de0fd�Z7de0fd �Z8de0fd!�Z9de0fd"�Z:d#� Z;d$e-de0fd%�Z<d&� Z=d'� Z>d(� Z?d)� Z@d*� ZAd+e-de0fd,�ZBd-e5de0fd.�ZCd/edee0 fd0�ZDde5fd1�ZEd2e-dee0e0f fd3�ZFd2e-dee0e0f fd4�ZGd2e-dee0e0f fd5�ZHd6e-d7e0de0fd8�ZId9eej ejJ f de-fd:�ZK dQd;e-d<e-d=e-d>e5dee5e-f f
d?�ZLde-fd@�ZMde0fdA�ZNdBe-dee5 fdC�ZOdBe-fdD�ZPdBe-fdE�ZQdF� ZRdGe-de-fdH�ZSde0fdI�ZTdJe-de-fdK�ZUdeVe-dz e-dz f fdL�ZWde0fdM�ZXde0fdN�ZYdO� ZZdP� Z[dS )S� N)�ConfigParser�Error)�cache)�Any�AnyStr�Dict�Optional�Tuple�Union)�ExternalProgramFailed�
check_command�exec_utility�run_commandz/etc/sysconfig/rhn/systemid)�Mon�Tue�Wed�Thu�Fri�Sat�Sunz /opt/cloudlinux/litespeed_statusz/opt/cloudlinux/nginx_statusz/opt/apache2nginx/statec � � d}t j � |� � r& t j |� � }n# t $ r Y nw xY w| |k r= t j |� � n# t $ r Y nw xY wt j | |� � dS dS )a
Create symlink link_path -> link_value if it does not exist or
points to different location
:param link_value: path that symlink should point to (symlink value)
:type link_value: str
:param link_path: path where to create symlink
:type link_path: str
N)�os�path�islink�readlink�OSError�unlink�symlink)�
link_value� link_path�link_tos �n/builddir/build/BUILD/imunify360-venv-2.6.3/opt/imunify360/venv/lib/python3.11/site-packages/clcommon/utils.py�create_symlinkr# 1 s� � � �G� �w�~�~�i� � � � ��k�)�,�,�G�G��� � � ��D� �����W��� ��I�i� � � � ��� � � ��D� ����
�
�:�y�)�)�)�)�)� �s! �8 �
A�A�A$ �$
A1�0A1c �� � g }t j � | � � r>t | d|�� � 5 }|� � � }ddd� � n# 1 swxY w Y |S )a
Read file and return file's lines
errors param may be passed to define how handle
unicode errors, errors=None is default value of open()
:param path: path to file
:param unicode_errors_handle: how to handle unicode errors
:return: list of file's lines
�utf-8)�encoding�errorsN)r r �isfile�open� readlines)r �unicode_errors_handle�content�fs r"