File: //opt/cloudlinux/venv/lib/python3.11/site-packages/clveconfig/__pycache__/ve_config.cpython-311.pyc
�
xޘfS � �� � d dl mZ d dlZd dlmZ d dlmZ d dlm Z ddl
mZmZ ej
� ed� � Zed z Zd
a G d� de� � Zdd�Zd� Zd� ZdS )� )�absolute_importN)�minidom)�
ExpatError)�etree� )�
CONFIG_DIR�acquire_lockzve.cfgz.tmp�NNc � � � e Zd Zd� fd� Z� xZS )�BadVeConfigException�Nothingc �^ �� t t | � � � d|z � � d S )Nz8Unable to parse /etc/container/ve.cfg file, message: %s )�superr �__init__)�self�message� __class__s ��K/opt/cloudlinux/venv/lib64/python3.11/site-packages/clveconfig/ve_config.pyr zBadVeConfigException.__init__ s= �� �
�"�D�)�)�2�2�
�$�
%� &� &� &� &� &� )r
)�__name__�
__module__�__qualname__r �
__classcell__)r s @r r r s= �� � � � � �&� &� &� &� &� &� &� &� &� &r r Tc �X � t dk r | rt S t � � 5 t j t � � }|� d� � d }| r||fa ||fcddd� � S # t t t t f$ r t d� � �w xY w# 1 swxY w Y dS )z�
Load xml config from ve.cfg
1. setup lock on file
2. read info
3. remove lock
:type use_cache: bool
:rtype: tuple[xml.Document, xml.Element]
:raises: BadVeConfigException, LockFailedException
r
� lveconfigr Nzbad ve.cfg file)�PARSED_XML_CACHEr �xml�parse�VE_CFG_PATH�getElementsByTagName�OSError�IOErrorr �
IndexErrorr )� use_cache�_ve_cfg�
_ve_lveconfigs r �get_xml_configr'