HEX
Server: nginx/1.24.0
System: Linux webserver 6.8.0-87-generic #88-Ubuntu SMP PREEMPT_DYNAMIC Sat Oct 11 09:28:41 UTC 2025 x86_64
User: wpuser (1002)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/cloudinit/sources/azure/__pycache__/errors.cpython-312.pyc
�

쑛hL�	��ddlZddlZddlZddlZddlmZmZddlmZddlm	Z	m
Z
mZmZm
Z
ddlmZddlZddlmZmZddlmZej.e�Z	d)deed	ed
edefd�ZGd
�de�ZGd�de�ZGd�de�ZGd�de�Z Gd�de�Z!Gd�de�Z"Gd�de�Z#Gd�de�Z$Gd�de�Z%Gd�d e�Z&Gd!�d"e�Z'Gd#�d$e�Z(Gd%�d&e�Z)Gd'�d(e�Z*y)*�N)�datetime�timezone)�StringIO)�Any�Dict�List�Optional�Tuple)�ElementTree)�subp�version)�UrlError�data�	delimiter�	quotechar�returnc���t�5}tj|||tj��j	|�|j�j
�cddd�S#1swYyxYw)zEncode report data with csv.)rr�quotingN)r�csv�writer�
QUOTE_MINIMAL�writerow�getvalue�rstrip)rrr�ios    �@/usr/lib/python3/dist-packages/cloudinit/sources/azure/errors.py�
encode_reportrs]��
��	&�r��
�
�����%�%�		
�
�(�4�.��{�{�}�#�#�%�	&�	&�	&�s�AA)�)A2c�d�eZdZdd�dedeeeefddfd�Zdeedefd�Zde	fd	�Z
defd
�Zy)�ReportableErrorN)�supporting_data�reasonr rc���dtj���|_d|_||_|r||_ni|_t
jtj�|_
y)NzCloud-Init/z%https://aka.ms/linuxprovisioningerror)r
�version_string�agent�documentation_urlr!r r�nowr�utc�	timestamp)�selfr!r s   r�__init__zReportableError.__init__'sR��#�7�#9�#9�#;�"<�=��
�!H�������#2�D� �#%�D� �!���h�l�l�3����vm_idc�2�dd|j��d|j��g}||jj�D��cgc]\}}|�d|����c}}z
}|d|��d|jj���d|j��gz
}t|�Scc}}w)Nzresult=errorzreason=zagent=�=zvm_id=z
timestamp=zdocumentation_url=)r!r$r �itemsr(�	isoformatr%r)r)r,r�k�vs     r�as_encoded_reportz!ReportableError.as_encoded_report5s���
��d�k�k�]�#��T�Z�Z�L�!�
��
	
��(<�(<�(B�(B�(D�E���1�A�3�a��s��E�E����U�G������1�1�3�4�5� ��!7�!7� 8�9�
�	
���T�"�"��Fs�Bc���t|t�xrO|j|jk(xr4|j|jk(xr|j|jk(S)N)�
isinstancerr(r!r )r)�others  r�__eq__zReportableError.__eq__HsV���u�o�.�
>����%�/�/�1�
>����u�|�|�+�
>��$�$��(=�(=�=�		
r+c��|jj�d|j�d|j�d|j�d�S)Nz(reason=z, timestamp=z, supporting_data=�))�	__class__�__name__r!r(r )r)s r�__repr__zReportableError.__repr__PsL���~�~�&�&�'�(��k�k�]�#����(�)�#�3�3�4�A�
7�	
r+)r;�
__module__�__qualname__�strr	rrr*r3�boolr7r<�r+rrr&sd��JN�4��4�/7��S�#�X��/G�4�	
�4�#���}�#�

�	#�&
�t�
�
�#�
r+rc�(��eZdZdeddf�fd�Z�xZS)�$ReportableErrorDhcpInterfaceNotFound�durationrNc�B��t�|�d�||jd<y)Nzfailure to find DHCP interfacerD��superr*r )r)rDr:s  �rr*z-ReportableErrorDhcpInterfaceNotFound.__init__Zs!���
���9�:�+3����Z�(r+)r;r=r>�floatr*�
__classcell__�r:s@rrCrCYs���4��4�4�4�4r+rCc�2��eZdZdedeeddf�fd�Z�xZS)�ReportableErrorDhcpLeaserD�	interfacerNc�`��t�|�d�||jd<||jd<y)Nzfailure to obtain DHCP leaserDrMrF)r)rDrMr:s   �rr*z!ReportableErrorDhcpLease.__init__as1���
���7�8�+3����Z�(�,5����[�)r+)r;r=r>rHr	r?r*rIrJs@rrLrL`s&���6��6�8�C�=�6�T�6�6r+rLc�j��eZdZdeedeedeedeeeeefdeeefddf�fd�Z	�xZ
S)	�(ReportableErrorDhcpOnNonPrimaryInterfacerM�driver�router�
static_routes�leaserNc���t�|�d�||jd<||jd<||jd<||jd<||jd<y)Nz&failure to find primary DHCP interfacerMrQrRrSrTrF)r)rMrQrRrSrTr:s      �rr*z1ReportableErrorDhcpOnNonPrimaryInterface.__init__isc���	���A�B�,5����[�)�)/����X�&�)/����X�&�0=����_�-�(-����W�%r+)r;r=r>r	r?rr
rrr*rIrJs@rrPrPhso���.��C�=�.���
�	.�
��
�.� ��U�3��8�_� 5�6�
.��C��H�~�.�
�.�.r+rPc�,��eZdZdededdf�fd�Z�xZS)�ReportableErrorImdsUrlError�	exceptionrDrNc���t|jtj�rd}nmt|jtj�rd}nFt|jtj
�rd}n|jrd|j�d�}nd}t�|�!|�|jr|j|jd<||jd<t|�|jd	<|j|jd
<y)Nz connection timeout querying IMDSzconnection error querying IMDSzread timeout querying IMDSzhttp error z querying IMDSzunexpected error querying IMDS�	http_coderDrX�url)r5�cause�requests�ConnectTimeout�ConnectionError�ReadTimeout�coderGr*r �reprr[)r)rXrDr!r:s    �rr*z$ReportableErrorImdsUrlError.__init__|s�����i�o�o�x�'>�'>�?�7�F�
�	����)A�)A�
B�5�F�
�	����)=�)=�
>�1�F�
�^�^�"�9�>�>�"2�.�A�F�5�F�
���� ��>�>�09���D� � ��-�+3����Z�(�,0��O����[�)�&/�m�m����U�#r+)r;r=r>rrHr*rIrJs@rrWrW{s"���4�X�4��4�4�4�4r+rWc�,��eZdZdededdf�fd�Z�xZS)�"ReportableErrorImdsInvalidMetadata�key�valuerNc���t�|�d|���||jd<||jd<t|�j|jd<y)Nzinvalid IMDS metadata for key=rerf�type)rGr*r rhr;)r)rerfr:s   �rr*z+ReportableErrorImdsInvalidMetadata.__init__�sR���
���9�#��?�@�&)����U�#�(-����W�%�'+�E�{�';�';����V�$r+)r;r=r>r?rr*rIrJs@rrdrd�s"���<�s�<�3�<�4�<�<r+rdc�(��eZdZdeddf�fd�Z�xZS)�+ReportableErrorImdsMetadataParsingExceptionrXrNc�T��t�|�d�t|�|jd<y)Nzerror parsing IMDS metadatarX�rGr*rbr �r)rXr:s  �rr*z4ReportableErrorImdsMetadataParsingException.__init__�s%���
���6�7�,0��O����[�)r+)r;r=r>�
ValueErrorr*rIrJs@rrjrj�s���<�Z�<�D�<�<r+rjc� ��eZdZd�fd�Z�xZS)�ReportableErrorOsDiskPpsFailurec�$��t�|�d�y)Nzerror waiting for host shutdown�rGr*�r)r:s �rr*z(ReportableErrorOsDiskPpsFailure.__init__�s���
���:�;r+�rN�r;r=r>r*rIrJs@rrprp�s
���<�<r+rpc�(��eZdZdeddf�fd�Z�xZS)�!ReportableErrorOvfInvalidMetadata�messagerNc�*��t�|�d|���y)Nz)unexpected metadata parsing ovf-env.xml: rr)r)rxr:s  �rr*z*ReportableErrorOvfInvalidMetadata.__init__�s���
���D�W�I�N�Or+)r;r=r>r?r*rIrJs@rrwrw�s���P��P��P�Pr+rwc�<��eZdZdejddf�fd�Z�xZS)�"ReportableErrorOvfParsingExceptionrXrNc�B��|j}t�|�	d|���y)Nzerror parsing ovf-env.xml: )�msgrGr*)r)rXrxr:s   �rr*z+ReportableErrorOvfParsingException.__init__�s!����-�-��
���6�w�i�@�Ar+)r;r=r>�ET�
ParseErrorr*rIrJs@rr{r{�s#���B�R�]�]�B�t�B�Br+r{c�(��eZdZdeddf�fd�Z�xZS)�!ReportableErrorUnhandledExceptionrXrNc���t�|�d�djtjt|�||j��}|jd�}|ddd�}dj|�}tj|jd��jd�}t|�|jd<||jd<y)Nzunhandled exception��
���zutf-8rX�traceback_base64)rGr*�join�	traceback�format_exceptionrh�
__traceback__�split�base64�	b64encode�encode�decoderbr )r)rX�trace�trace_lines�reversed_trace_lines�reversed_trace�trace_base64r:s       �rr*z*ReportableErrorUnhandledException.__init__�s����
���.�/�����&�&��Y���I�,C�,C�
�
��
�k�k�$�'��*�4�R�4�0�����#7�8���'�'��(=�(=�g�(F�G�N�N��
��-1��O����[�)�3?����/�0r+)r;r=r>�	Exceptionr*rIrJs@rr�r��s���@�)�@��@�@r+r�c� ��eZdZd�fd�Z�xZS)�!ReportableErrorProxyAgentNotFoundc�$��t�|�d�y)Nzazure-proxy-agent not foundrrrss �rr*z*ReportableErrorProxyAgentNotFound.__init__�s���
���6�7r+rtrurJs@rr�r��s
���8�8r+r�c�<��eZdZdejddf�fd�Z�xZS)�&ReportableErrorProxyAgentStatusFailurerXrNc���t�|�d�|j|jd<|j|jd<|j
|jd<y)Nz azure-proxy-agent status failure�	exit_code�stdout�stderr)rGr*r�r r�r�rms  �rr*z/ReportableErrorProxyAgentStatusFailure.__init__�sS���
���;�<�,5�,?�,?����[�)�)2�)9�)9����X�&�)2�)9�)9����X�&r+)r;r=r>r�ProcessExecutionErrorr*rIrJs@rr�r��s!���:�$�"<�"<�:��:�:r+r�c�8��eZdZdd�dedeeddf�fd�Z�xZS)�ReportableErrorVmIdentificationN)�system_uuidrXr�rc�r��t�|�d�t|�|jd<||jd<y)Nzfailure to identify Azure VM IDrXr�rl)r)rXr�r:s   �rr*z(ReportableErrorVmIdentification.__init__�s7���	���:�;�,0��O����[�)�.9����]�+r+)r;r=r>r�r	r?r*rIrJs@rr�r��s,���DH�:�%�:�4<�S�M�:�	
�:�:r+r�)�|�')+r�r�loggingr�rrrr�typingrrrr	r
�	xml.etreerr~r]�	cloudinitrr
�cloudinit.url_helperr�	getLoggerr;�LOGr?rr�rrCrLrPrWrdrjrprwr{r�r�r�r�rAr+r�<module>r�s��
�
���'��3�3�'��#�)��g����!��=@�
&�
�s�)�
&� #�
&�69�
&��
&� 0
�i�0
�f4�?�4�6��6�.��.�&4�/�4�0<��<�<�/�<�<�o�<�
P��P�
B��B�@��@�(8��8�
:�_�:�:�o�:r+