Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/libcloud/container/drivers/__pycache__/lxd.cpython-39.pyc
Ðазад
a q�h\� � @ s� d dl Z d dlZd dlZd dlZzd dlZW n eyF d dlZY n0 d dlmZ d dlm Z d dl mZmZ d dl m Z d dlmZ d dlmZmZmZ d dlmZ d d lmZ d d lmZ d dlmZ dgZg d �Zg d�ZdZdd� Z dd� Z!dd� Z"G dd� de�Z#G dd� de$�Z%G dd� de$�Z&e�'dg d��Z(G dd� de�Z)G d d!� d!e�Z*G d"d#� d#e �Z+G d$d%� d%e�Z,dS )&� N)�httplib)�b)�JsonResponse�ConnectionUserAndKey)�KeyCertificateConnection)�InvalidCredsError)� Container�ContainerDriver�ContainerImage)� BaseHTTPError)� StorageVolume)�Provider)�ContainerStateZSuccess)�stop�start�restart�freeze�unfreeze)�imageZ migration�copy�none�errorc C s* ddg}|D ]}| � |�r| �|�} q| S )Nzhttp://�https://)� startswith�strip)�host�prefixes�prefix� r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/libcloud/container/drivers/lxd.py�strip_http_prefix6 s r c K s$ | du s|du rt d��| dks(|dkr0t d��d|�� v rv| �d�}|d |d vrvt dt|d � d |d ��d |�� v r�|�d�}|d |d vr�t d t|d � d |d ��tj�| �}tj�|�o�tj�|�}|s�t d��tj�|�}tj�|��otj�|�}|�s t d��dS ) zH Basic checks for the provided certificates in LXDtlsConnection NzJTLS Connection requires specification of a key file and a certificate file� Zkey_files_allowed�.���zValid key files are: zyou provided: Zcert_files_allowedzValid certification files are: zRYou need a key file to authenticate with LXD tls. This can be found in the server.zZYou need a certificate file to authenticate with LXD tls. This can be found in the server.) r �keys�split�str�os�path� expanduser�exists�isfile)�key_file� cert_file�kwargsZkey_file_suffixZcert_file_suffixZkeypathZis_file_pathZcertpathr r r �check_certificates? s@ ��� ���r/ c C sD | d t krtd| d��| d |kr@d�|| d �}t|| d��dS )zS Basic checks that the response is of the type the client is expecting �typezresponse type is error)�message� response_dict�status_codez,Status code should be {0} but is {1}N)�LXD_ERROR_STATUS_RESP�LXDAPIException�format)r2 r3 �msgr r r �assert_responsep s ���r8 c s* e Zd ZdZd� fdd� Zdd� Z� ZS ) r5 zW Basic exception to be thrown when LXD API returns with some kind of error �Unknown Error OccurredNc s || _ || _tt| ��|� d S �N)r1 r2 �superr5 �__init__)�selfr1 r2 �� __class__r r r<