%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3.9/site-packages/cloudinit/handlers/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3.9/site-packages/cloudinit/handlers/__pycache__/__init__.cpython-39.pyc

a

'�Dg}&�
@sddlZddlZddlZddlmZmZmZddlmZm	Z	m
Z
e�e�Z
dZdZdZdZeegZdgZd	Zd
Zddd
dddddddddd�Zeee���dd�d�ZGdd�dejd�Zdd�Zdd �Zd!d"�Zd#d$�Z d%d&�Z!d'd(�Z"d)d*�Z#d+d,�Z$e
fd-d.�Z%d1d/d0�Z&dS)2�N)�importer�
type_utils�util)�FREQUENCIES�
PER_ALWAYS�PER_INSTANCEztext/x-not-multipartzapplication/octet-streamZ__end__Z	__begin__ztext/part-handlerzpart-handler-%03dz	part-%03dztext/x-include-urlztext/x-include-once-urlztext/x-shellscriptztext/cloud-configztext/cloud-boothookztext/cloud-config-archiveztext/cloud-config-jsonpztext/jinja2�text/x-shellscript-per-boot�text/x-shellscript-per-instance�text/x-shellscript-per-once)z#includez
#include-oncez#!z
#cloud-configz
#part-handlerz#cloud-boothookz#cloud-config-archivez#cloud-config-jsonpz## template: jinjarr	r
cCsdt|�S)Nr)�len)�e�r
�?/usr/lib/python3.9/site-packages/cloudinit/handlers/__init__.py�<lambda>>�r)�keyc@s4eZdZddd�Zdd�Zdd�Zejdd	��Zd
S)�Handler�cCs||_||_dS�N)�handler_version�	frequency)�selfr�versionr
r
r�__init__CszHandler.__init__cCsdt�|�|��fS)Nz%s: [%s])rZobj_name�
list_types�rr
r
r�__repr__GszHandler.__repr__cCs,t|d�std��ndd�t|d�D�SdS)N�prefixesz#Missing prefixes subclass attributecSsg|]}t|�qSr
)�INCLUSION_TYPES_MAP)�.0�prefixr
r
r�
<listcomp>Os�z&Handler.list_types.<locals>.<listcomp>)�hasattr�NotImplementedError�getattrrr
r
rrJs


�zHandler.list_typescOs
t��dSr)r#)r�args�kwargsr
r
r�handle_partTszHandler.handle_partN)r)	�__name__�
__module__�__qualname__rrr�abc�abstractmethodr'r
r
r
rrBs


r)�	metaclassc	Cs|j}|tks"|tkr|tks"dSz|j}t|�}WntttfyPd}Yn0|d}zxt�	d|||||�|dkr�|�
||||||�nB|dkr�|�
|||||�n&|dkr�|�
||||�ntd|��Wn(ty�t�
td|||||�Yn0dS)N��Content-Typez1Calling handler %s (%s, %s, %s) with frequency %s�rzUnknown module version %sz8Failed calling handler %s (%s, %s, %s) with frequency %s)rrrr�int�	TypeError�
ValueError�AttributeError�LOG�debugr'�	Exceptionr�logexc)	�mod�data�filename�payloadr�headersZmod_freqZmod_ver�content_typer
r
r�run_partYsT���
���r?cCsdti}t||dd||�dS�Nr/)�
CONTENT_STARTr?�r9r:rr=r
r
r�
call_begin�s�rCcCsdti}t||dd||�dSr@)�CONTENT_ENDr?rBr
r
r�call_end�s�rEc
	Cs�|d}t|}|d}tj�|dd|�}|�d�s@d|}t�||d�|d}z<tt�	|��}	t
|	|d	|�|j|	d
d�|d|d<Wn"ty�t�
td
||�Yn0dS)NZhandlercountrZ
handlerdirz%sz.pyz%s.pyi��handlersr:T)Zinitializedr.z7Failed at registering python file: %s (part handler %s))�PART_HANDLER_FN_TMPL�os�path�join�endswithrZ
write_file�
fixup_handlerr�
import_modulerC�registerr7r8r5)
ZpdataZ_ctypeZ	_filenamer<Zcurcount�modnamerZmodfnamerFr9r
r
r�walker_handle_handler�s(
�rPcCs�z\t|t�r|�dd�d}n$|dd|�jdd��dd�d}t|�|krZ|d|�}Wntyz|d|�}Yn0|S)N�
r.r��ignore)�errors)�
isinstance�str�split�decoder�UnicodeDecodeError)Zblob�size�startr
r
r�_extract_first_or_bytes�s
$r\cCs\z|�d�WSttfyFz|�d�WYSty@Yn0YntyVYn0|S)NZ
string_escapeZunicode_escape)�encode�LookupErrorr2r4)�textr
r
r�_escape_string�s
r`cCs�|d}||�d�vr&t�d|�dS|tvr@t||||�dS|d}||vrpt|||d|||d|�nN|r�t|d�}dt|�}|tkr�t�	d	||�q�t�	d
||�nt�d|�dS)Nr/Zexcludedzcontent_type "%s" is excludedrFr:r�z'%s...'z)Unhandled non-multipart (%s) userdata: %sz0Unhandled unknown content-type (%s) userdata: %szEmpty payload of type %s)
�getr5r6�PART_CONTENT_TYPESrPr?r\r`�NOT_MULTIPART_TYPE�warning)r:r;r<r=r>rFr[�detailsr
r
r�walker_callback�s@�
��rgc	Cs�d}|��D]t}|��dkrq|��}|dur2t}|��}|sFt|}t|�}t�|�||d<t	�
|�}|||||�|d}qdS)NrZ	multipartr/r.)�walkZget_content_maintypeZget_content_type�
OCTET_TYPE�get_filename�PART_FN_TPL�dictr5r6rZfully_decoded_payload)	�msg�callbackr:Zpartnum�partZctyper;r=r<r
r
rrhs 

rhcCsRt|d�st|dd�t|d�s.t|d|�n |j}|rN|tvrNt�d||�|S)Nrr.rz&Handler %s has an unknown frequency %s)r"�setattrrrr5re)r9Zdef_freqZfreqr
r
rrLs

rLcCsVzt�|���}Wnty(|YS0|��}tD]}|�|�r6t|Sq6|Sr)rZ
decode_binary�lowerrY�lstrip�INCLUSION_SRCH�
startswithr)r<�defaultZ
payload_lcr_r
r
r�type_from_starts_with#s

rv)N)'r+ZloggingrHZ	cloudinitrrrZcloudinit.settingsrrrZ	getLoggerr(r5rdrirDrAZCONTENT_SIGNALSrcrGrkr�sorted�list�keysrs�ABCMetarr?rCrErPr\r`rgrhrLrvr
r
r
r�<module>sP
��0)

Zerion Mini Shell 1.0