%PDF- %PDF-
Mini Shell

Mini Shell

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

�

�fW"���ddlZddlZddlZddlmZmZeje�Ze	ejg�ZGd�d�ZGd�d�Z
d�Z								dd�Z										d
d	�Z										d
d
�Z									dd�Zy)�N)�
url_helper�utilc��eZdZdZd�Zd�Zy)�MetadataLeafDecoderz.Decodes a leaf blob into something meaningful.c�p�|sy|j�}|jd�r|jd�ryy)NF�{�}T)�strip�
startswith�endswith)�self�texts  �?/usr/lib/python3/dist-packages/cloudinit/sources/helpers/ec2.py�_maybe_json_objectz&MetadataLeafDecoder._maybe_json_objects0�����z�z�|���?�?�3��D�M�M�#�$6���c�V�|sy	tj|�}|j|�r	t	j
|�S|jd�dk7r|j�S|S#t$r|cYSwxYw#ttf$r!}tjd||�Yd}~�bd}~wwxYw)N�z6Field %s looked like a json object, but it was not: %s�
���)r�
decode_binary�UnicodeDecodeErrorr�json�loads�
ValueError�	TypeError�LOG�warning�find�
splitlines)r
�field�blob�es    r�__call__zMetadataLeafDecoder.__call__s�����	��%�%�d�+�D��"�"�4�(�
��z�z�$�'�'��9�9�T�?�b� ��?�?�$�$����"�	��K�	���	�*�
����L������
�s(�A'�A8�'A5�4A5�8B(�B#�#B(N)�__name__�
__module__�__qualname__�__doc__rr#�rrrrs��8��rrc�&�eZdZdd�Zd�Zd�Zd�Zy)�MetadataMaterializerNc�n�||_d|_||_||_|�t	�|_y||_y�N)�_blob�_md�	_base_url�_callerr�
_leaf_decoder)r
r!�base_url�caller�leaf_decoders     r�__init__zMetadataMaterializer.__init__7s7����
����!��������!4�!6�D��!-�D�rc��i}g}tj|�}|s||fSd�}d�}|j�D]�}|j�}||�}|r|s� |dk(r�&||�r||vs�3|j	|��E|jdd�}|}	t
|�dkDr#|\}
}tj|
�}
|
�d|
z}	|}|	||<��||fS)Nc�(�|jd�ryy)N�/TF)r��items r�has_childrenz1MetadataMaterializer._parse.<locals>.has_childrenIs���}�}�S�!��rc�J�|jd�r|jd�S|S)Nr8)r�rstripr9s r�get_namez-MetadataMaterializer._parse.<locals>.get_nameOs"���}�}�S�!��{�{�3�'�'��Krzsecurity-credentials�=�z%s/openssh-key)rrrr
�append�split�len�safe_int)r
r!�leaves�childrenr;r>r �
field_name�contents�resource�ident�sub_contentss            r�_parsezMetadataMaterializer._parseAs��������!�!�$�'����H�%�%�	�	�
�_�_�&�	.�E��K�K�M�E�!�%��J��
���3�3���E�"��X�-��O�O�J�/� �;�;�s�A�.��%���x�=�1�$�,4�)�U�L� �M�M�%�0�E��(�#3�u�#=��%1�
�%-��z�"�+	.�,��!�!rc��|j�|jS|j|j|j�|_|jSr,)r.�_materializer-r/)r
s r�materializez MetadataMaterializer.materializels:���8�8���8�8�O��$�$�T�Z�Z����@����x�x�rc�&�|j|�\}}i}|D]T}tj||�}|jd�s|dz
}|j	|�}|j||�||<�Vi}	|j
�D]A\}
}tj||�}|j	|�}
|j|
|
�|	|
<�Ci}|j|�|	j�D]%}
|
|vrtjd|��|	|
||
<�'|S)Nr8z&Duplicate key found in results from %s)rLr�combine_urlrr0rN�itemsr1�update�keysrr)r
r!r2rErF�child_contents�c�	child_url�
child_blob�
leaf_contentsr rI�leaf_url�	leaf_blob�joineds               rrNz!MetadataMaterializer._materializers*��!�[�[��.�������	I�A�"�.�.�x��;�I��%�%�c�*��S� �	����i�0�J� $� 1� 1�*�i� H�N�1��	I��
�!'����	H��U�H�!�-�-�h��A�H����X�.�I�#'�#5�#5�e�Y�#G�M�%� �	H����
�
�n�%�"�'�'�)�	5�E�������D�h�O� -�e� 4��u�
�		5�
�
rr,)r$r%r&r5rLrOrNr(rrr*r*6s��.�)"�V�rr*c��|j|vS)z/Returns False if cause.code is in status_codes.)�code)�status_codes�
_request_args�causes   r�skip_retry_on_codesrb�s���:�:�\�)�)rc	���tj||�}tj|d�}d}		|stjtt
�}tj|||||||��}
|
j}	|	S#tj$r8}|jt
vrtjtd|�Yd}~|	Sd}~wt$rtjtd|�Y|	SwxYw)Nz	user-datar)�ssl_details�timeout�retries�exception_cb�
headers_cb�headers_redactz$Failed fetching userdata from url %s)rrQ�	functools�partialrb�SKIP_USERDATA_CODES�read_file_or_urlrH�UrlErrorr^r�logexcr�	Exception)�api_version�metadata_addressrdrerfrhrirg�ud_url�	user_data�responser"s            r�get_instance_userdatarv�s����
#�
#�$4�k�
B�F�
�
#�
#�F�K�
8�F��I�I��%�,�,�#�%8��L��.�.��#���%�!�)�
���%�%�	�������M��6�6�,�,��K�K��C�V�L������I����C�?��H���I�s�AA:�:C+�
-C�'C+�*C+c	�z�
��tj|||�}tjtj||||||	�����
fd�}	�|�}
t|
j|||��}|j�}t|t�si}|S#t$r!tjtd||�icYSwxYw)N)rdrerfrhrirgc���	�|�jS#tj$r+}�r�|�s�tj	d|�Yd}~yd}~wwxYw)Nz&Skipped retrieval of the content of %sz	(skipped))rHrrnrr)�urlr"r3�retrieval_exception_ignore_cbs  ��r�mcallerz'_get_instance_metadata.<locals>.mcaller�sN���
	#��#�;�'�'�'���"�"�	#�1�4�Q�7�����D�c�J�"��	#�s��A�!A�A)r4zFailed fetching %s from url %s)rrQrjrkrmr*rHrO�
isinstance�dictrprror)�treerqrrrdrerfr4rhrirgrz�md_urlr{ru�materializer�mdr3s          `     @r�_get_instance_metadatar��s�����
#�
#�$4�k�4�
H�F�
�
�
��#�#�����%�!��F�#���&�>��+����v�w�\�
���
%�
%�
'���"�t�%��B��	�������C�9�4��H��	��s�AB�'B:�9B:c

�.�td||||||||||	��S)Nz
meta-data/)r~rqrrrdrerfr4rirhrgrz�r�)
rqrrrdrerfr4rhrirgrzs
          r�get_instance_metadatar��s2��"�
��)����!�%��!�&C��rc	�,�td|||||||||��
S)Nzdynamic/instance-identity)
r~rqrrrdrerfr4rirhrgr�)	rqrrrdrerfr4rhrirgs	         r�get_instance_identityr�s/��"�
(��)����!�%��!��r)�latest�http://169.254.169.254N�r�NNN)
r�r�Nr�r�NNNNN)	r�r�Nr�r�NNNN)rjr�logging�	cloudinitrr�	getLoggerr$r�	frozenset�	NOT_FOUNDrlrr*rbrvr�r�r�r(rr�<module>r�s������&��g����!����!5�!5� 6�7����FQ�Q�h*��-��
�
����$�R�-��
�
�����"&�0�h�-��
�
�����"&��<�-��
�
�����r

Zerion Mini Shell 1.0