%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/cloudinit/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/cloudinit/__pycache__/user_data.cpython-312.pyc

�

�f�9��D�ddlZddlZddlmZddlmZddlmZddlm	Z	ddl
mZmZm
Z
ddlmZmZej"e�Zej(Zej*Zej,ZdZd	d
gZddgZd
gZd	ZdZdZgd�ZdZdgZ d�Z!d�Z"dd�Z#Gd�d�Z$d�Z%efd�Z&y)�N)�MIMEBase)�
MIMEMultipart)�MIMENonMultipart)�MIMEText)�features�handlers�util)�UrlError�read_file_or_urlzContent-Typez
text/plainztext/x-not-multipartztext/x-include-urlztext/x-include-once-urlztext/cloud-config-archiveztext/cloud-configzapplication/octet-stream)zapplication/gzipzapplication/gzip-compressedzapplication/gzippedzapplication/x-compresszapplication/x-compressedzapplication/x-gunzipzapplication/x-gzipzapplication/x-gzip-compressedzNumber-Attachmentsc��||=|||<y�N�)�msg�key�values   �5/usr/lib/python3/dist-packages/cloudinit/user_data.py�_replace_headerr;s���C���C��H�c�D�|d=|jddt|���y)NzContent-Disposition�
attachment)�filename)�
add_header�str)rrs  r�
_set_filenamer@s"���!�"��N�N�(�,��X��N�Orc�f�tjrt|�|�tj	|�yr
)r�ERROR_ON_USER_DATA_FAILURE�RuntimeError�LOG�warning)�
error_message�source_exceptions  r�
_handle_errorr"Es%���*�*��=�)�/?�?����M�"rc�J�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
dd
�Zd�Zy	)
�UserDataProcessorc�F�||_tj|�|_yr
)�pathsr	�fetch_ssl_details�ssl_details)�selfr&s  r�__init__zUserDataProcessor.__init__Ms����
��1�1�%�8��rc��t�}t|t�r$|D]}|jt	|�|��|S|jt	|�|�|Sr
)r�
isinstance�list�_process_msg�convert_string)r)�blob�accumulating_msg�bs    r�processzUserDataProcessor.processQsa��(�?���d�D�!��
G���!�!�.��"3�5E�F�
G� ��
���n�T�2�4D�E��rc
��d�}|j�D�]r}t|�r�d}|j�}tj|�}d}|t
vr	tj|d��}d}d}|st}|tdgzvr||�}|�|}|r�|jdd�\}}t||�}
|
j|�|j!�rt#|
|j!��d	D] }||vs�t%|
|t'||���"|
}||k7rt%|t(|�|t*vr|j-||���4|t.vr|j1||���Pt%|t(|�|j3||���uy#tj$r3}	dj|t|�|	�}
t|
|	�Yd}	~	���d}	~	wwxYw)
Nc�,�tj|�Sr
)r�type_from_starts_with)�payloads r�
find_ctypez2UserDataProcessor._process_msg.<locals>.find_ctype[s���1�1�'�:�:rF)�quietTz<Failed decompressing payload from {} of length {} due to: {}ztext/x-shellscript�/�)�Launch-Index)�walk�is_skippable�get_content_typer	�fully_decoded_payload�DECOMP_TYPES�decomp_gzip�DecompressionError�format�lenr"�
UNDEF_TYPE�TYPE_NEEDED�splitr�set_payload�get_filenamerrr�CONTENT_TYPE�
INCLUDE_TYPES�_do_include�
ARCHIVE_TYPES�_explode_archive�_attach_part)r)�base_msg�
append_msgr8�part�ctype�
ctype_origr7�was_compressed�er �maintype�subtype�n_part�hs               rr.zUserDataProcessor._process_msgZs���	;��M�M�O�J	0�D��D�!���E��.�.�0�J��0�0��6�G�"�N�
�\�)��"�.�.�w�e�D�G�"&�J�%)�N��'�
��[�,@�+A�A�A�"�7�+���}�"���$)�K�K��Q�$7�!��'�)�(�G�<���"�"�7�+��$�$�&�!�&�$�*;�*;�*=�>�*�A�A��D�y�'���3�t�A�w�<�@�A����
�"���l�E�:��
�%�� � ��*�5���
�%��%�%�g�z�:��
�H�l�E�:����j�$�/�UJ	0��&�.�.��0�06��&��G��a�1�"�"�-��3����s�F�G�(G�Gc�r�|jdd�}d}|j�tvr9	tj|jd���}|r|jd�}|�|}|�|}|�&	|jdtt|���yy#t$rY�<wxYw#ttf$rYywxYw)Nr<T��decode�launch-index)�getr?�EXAMINE_FOR_LAUNCH_INDEXr	�	load_yaml�get_payload�	Exceptionrr�int�
ValueError�	TypeError)r)r�
header_idx�payload_idxr7s     r�_attach_launch_indexz&UserDataProcessor._attach_launch_index�s����W�W�^�T�2�
������!�%=�=�
��.�.������)E�F���")�+�+�n�"=�K��!�$�K���$�K��"�
����~�s�3�{�3C�/D�E�#���
��
���	�*�
��
�s#�8B�/$B$�	B!� B!�$B6�5B6c��tj|dd�}tjj	|j
j
d�d|�S)N�md5�@�data�urlcache)r	�	hash_blob�os�path�joinr&�
get_ipath_cur)r)�entry�entry_fns   r�_get_include_once_filenamez,UserDataProcessor._get_include_once_filename�s?���>�>�%���3���w�w�|�|��J�J�$�$�V�,�j�(�
�	
rc�l�|j�st|t|z�|j|�yr
)rJr�PART_FN_TPLrj)r)r�attached_ids   r�_process_before_attachz(UserDataProcessor._process_before_attach�s+�����!��#�{�k�:�;��!�!�#�&rc�H�d}|j�D�]�}|j�}|jd�r|td�dj	�}d}n/|jd�r|td�dj	�}d}|jd�r��|j�}|s��d}d}|r|j
|�}|r5tjj|�rtj|�}n�	t|dd|j��}|r2|j�r"tj||j d	�
�|j�r
|j }n'dj#||j$�}	t'|	�|���|t/|�}
|j1|
|����y#t($r9}
t+|
�}||vr|dj#|�z
}t'||
�Yd}
~
�bd}
~
wt,$r(}d
j#||�}	t'|	|�Yd}~��d}~wwxYw)NFz
#include-onceTz#include�#��
)�timeout�retriesr(i�)�modez6Fetching from {} resulted in a invalid http code of {}z
 for url: {0}zFetching from {} resulted in {})�
splitlines�lower�
startswithrE�lstrip�striprwrqrr�isfiler	�load_text_filerr(�ok�
write_file�contentsrD�coder"r
r�IOErrorr/r.)r)�contentrR�include_once_on�line�lc_line�include_url�include_once_fn�respr �urle�message�ioe�new_msgs              rrMzUserDataProcessor._do_include�s�� ���&�&�(�>	7�D��j�j�l�G��!�!�/�2��C��0�2�3�:�:�<��#'���#�#�J�/��C�
�O�-�.�5�5�7��#(�����s�#���*�*�,�K���"�O��G��"&�"A�"A�+�"N���2�7�7�>�>�/�#B��-�-�o�>�� 6�+�#� !� "�$(�$4�$4�	�D�'�4�7�7�9����+�T�]�]����w�w�y�"&�-�-��9�9?�� +�T�Y�Y�:�&�&�m�4��"�(��1���!�!�'�:�6�}>	7��^ �1�!�$�i�G�#�'�1��?�#9�#9�+�#F�F��!�'�4�0�0���6�$E�$L�$L�#�S�%�M�"�-��5�5��	6�s%�:BF0�0	H!�9/G-�-H!�9H�H!c��tj|gttf��}|D�]�}t	|t
�rd|i}t	|t�s�)|jdd�}|jd�}|s2t}t	|t�rt}tj||�}|jdd�\}}	|dk(r.t	|t�r|j�}t||	��}
nt!||	�}
|
j#|�d	|vrt%|
|d	�d
|vr|
j'dt|d
��t|j)��D]U}|j+�dd	dd
dt,j+�t.j+�fvr�A|
j'|||��W|j1||
����y)
N)�default�allowedr���typer:r;�text)�_subtyperr_r<zcontent-disposition)r	rbr-�setr,r�dictr`�ARCHIVE_UNDEF_TYPE�bytes�ARCHIVE_UNDEF_BINARY_TYPErr6rHr^rrrIrr�keysr��ATTACHMENT_FIELDrKrP)r)�archiverR�entries�entr��mtyper�rXrYr�headers            rrOz"UserDataProcessor._explode_archives����.�.��"�t�S�k�J���0	/�C��#�s�#� �#�&���c�D�*���g�g�i��,�G��G�G�F�O�E��,���g�u�-�7�G� �6�6�w��H�� %���C�� 3��H�g��6�!��g�u�-�%�n�n�.�G��w��9���x��1������(��S� ��c�3�z�?�3���$����~�s�3�~�3F�/G�H��s�x�x�z�*�
4���<�<�>����"�)�$�*�*�,� �&�&�(�&������v�s�6�{�3�
4�
���j�#�.�a0	/rNc��t|vr	d|t<|�t|tt|��d}	t|j	t��}|S#t
tf$rt|tt|��Y|SwxYw)z
        Return the number of attachments to this MIMEMultipart by looking
        at its 'Number-Attachments' header.
        �0r)r�rrrer`rfrg)r)�	outer_msg�	new_count�
fetched_counts    r�_multi_part_countz#UserDataProcessor._multi_part_countFs���
�9�,�*-�I�&�'�� ��I�'7��Y��H��
�	M��	�
�
�.>� ?�@�M�����I�&�	M��I�'7��]�9K�L���	M�s�A�)A>�=A>c��|j|�}|j||dz�|j|�|j||dz�y)z�
        Attach a message to an outer message. outermsg must be a MIMEMultipart.
        Modifies a header in the outer message to keep track of number of
        attachments.
        r;N)r�r{�attach)r)r�rS�
part_counts    rrPzUserDataProcessor._attach_partXsJ���+�+�I�6�
��#�#�D�*�q�.�9���������y�*�q�.�9rr
)
�__name__�
__module__�__qualname__r*r3r.rjrwr{rMrOr�rPrrrr$r$Ls9��9� �N0�`�0
�'�
C7�J2/�h�$	:rr$c�T�|j�xsd}|j�dk(ryy)Nr��	multipartTF)�get_content_maintyper�)rS�
part_maintypes  rr>r>ds,���-�-�/�5�2�M������+��rc��|sd}d�}t|t�r|jd�}n|}tj|d��}d|ddj�vr&tj|jd��}|S|||�}|S)	zJconvert a string (more likely bytes) or a message into
    a mime message.rc�j�|jdd�\}}t||�}|j|�|S)Nr:r;)rHrrI)rn�content_typerXrYrs     r�
create_binmsgz%convert_string.<locals>.create_binmsgss6��(�.�.�s�A�6���'��x��)��������
rzutf-8Fr]s
mime-version:ri)r,r�encoder	rBr��message_from_stringr^)�raw_datar�r��bdatars     rr/r/ms��������(�C� �����(�������U�5�1�E��5��4�=�.�.�0�0��&�&�u�|�|�G�'<�=���J��E�<�0���Jrr
)'�loggingrq�email.mime.baser�email.mime.multipartr�email.mime.nonmultipartr�email.mime.textr�	cloudinitrrr	�cloudinit.url_helperr
r�	getLoggerr�r�NOT_MULTIPART_TYPEry�
OCTET_TYPErKrGrLrNrFr�r�rAr�rarrr"r$r>r/rrr�<module>r�s����	�$�.�4�$�.�.�;��g����!���0�0���"�"��
�
 �
 �
����3�4��%�'@�A�
�,�-�
�
�
�(��6��	��(��0�0���
P�
#�U:�U:�p�+=�r

Zerion Mini Shell 1.0