%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/uaclient/daemon/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/uaclient/daemon/__pycache__/retry_auto_attach.cpython-312.pyc

�

��>fU���ddlZddlZddlZddlmZmZmZmZmZddl	mZ
ddlmZm
Z
ddlmZddlmZddlmZddlmZmZej.ej0e��Zgd	�Zd
Zdedefd
�Zdefd�Z deddfd�Z!y)�N)�
exceptions�lock�messages�system�util)r)�FullAutoAttachOptions�full_auto_attach)�_is_attached)�UAConfig)�AUTO_ATTACH_STATUS_MOTD_FILE)�notices�state_files)�riii i@8�pr�Qr��r��r�Fr逗rz./run/ubuntu-advantage/flags/auto-attach-failed�e�returnc��t|tj�r*tjj|j��St|tj�rtjSt|tj�r*tjj|j��St|tj�r*tjj|j��St|tj�rOtj j|j"��djt%|j&��zSt|tj(�rdj|j*�St,j/d|��t%|�xstj0S)	N)�detail)�pid)�	error_msg)�urlz: "{}"z"{}"zUnexpected exception)�exc_info)�
isinstance�api_exceptions�InvalidProImager�$RETRY_ERROR_DETAIL_INVALID_PRO_IMAGE�formatr�NonAutoAttachImageError�(RETRY_ERROR_DETAIL_NON_AUTO_ATTACH_IMAGE�
LockHeldError�RETRY_ERROR_DETAIL_LOCK_HELDr�ContractAPIError�%RETRY_ERROR_DETAIL_CONTRACT_API_ERROR�body�ConnectivityError� RETRY_ERROR_DETAIL_URL_ERROR_URLr�str�cause_error�UbuntuProError�msg�LOG�error�
UNKNOWN_ERROR)rs �C/usr/lib/python3/dist-packages/uaclient/daemon/retry_auto_attach.py�,full_auto_attach_exception_to_failure_reasonr4)sW���!�^�3�3�4��<�<�C�C��;�;�D�
�	
�
�A�~�=�=�	>��@�@�@�	�A�~�3�3�	4��4�4�;�;����;�F�F�	�A�~�6�6�	7��=�=�D�D��f�f�E�
�	
�
�A�~�7�7�	8��8�8�?�?����@�
��O�O�C��
�
�.�/�0�	0�
�A�~�4�4�	5��}�}�Q�U�U�#�#��	�	�(�1�	�5��1�v�/��/�/�/��cfgc�b�tjj�tjj�t	j
t�tjtjj�tjtjj�y)N)r�retry_auto_attach_state_file�delete�retry_auto_attach_options_filer�ensure_file_absentrr
�remove�Notice�AUTO_ATTACH_RETRY_FULL_NOTICE�AUTO_ATTACH_RETRY_TOTAL_FAILURE)r6s r3�cleanupr@Asi���,�,�3�3�5��.�.�5�5�7�
���:�;��N�N����4�4���N�N����6�6�r5c	��t|�jrytjj	�}|�"|j
}t|d}|j}n
d}t}d}t|�D�]\}}tjjtjj�}|tj|��z}|jdd��}tjjtj ||z|���|}	|	�t"j$}		|j'�}t"j*j-||zdz|	|j/���}
t1j2t4d|
zdz�	t7j8d	�
�5t;j<t:j>j@||zdz|	|j/���ddd�tGjH|�t|�jrn[	tjJj	�}tM�}|�"|jN|_'|jP|_(tS|�ntg|�t|�js�tjjtj tit�|���|}	|	�t"j$}	t"jjj-tit�dz|	��}
t1j2t4d|
zdz�t;j<t:j>jltit�dz|	��yy#t($rY��VwxYw#1swY���xYw#tBjD$rY���wxYw#tTjV$rtXj[d�Y��ktTj\$r+}
tXj_|
j`�Yd}
~
���d}
~
wt($r+}
tc|
�}tXje|
�Yd}
~
���d}
~
wwxYw)
Nr)�seconds)�second�microsecond)�interval_index�failure_reason�)�num_attempts�reason�next_run_datestring�
z

z+pro.daemon.retry_auto_attach.notice_updates)�lock_holderz&already attached, ending retry service)rHrI)7r
�is_attachedrr8�readrE�RETRY_INTERVALSrF�	enumerate�datetime�now�timezone�utc�	timedelta�replace�write�RetryAutoAttachStaterr2�
astimezone�	Exception�AUTO_ATTACH_RETRY_NOTICEr"�	isoformatr�
write_filerr�	RetryLockr
�addr=r>rr%�time�sleepr:r�enable�enable_betar	r�AlreadyAttachedErrorr0�info�EntitlementsNotEnabledError�warningr/r4r1r@�len�&AUTO_ATTACH_RETRY_TOTAL_FAILURE_NOTICEr?)r6�persisted_state�offset�	intervalsrF�index�interval�last_attempt�next_attempt�
msg_reason�auto_attach_status_msg�persisted_options�optionsrs              r3�retry_auto_attachruMs����C��$�$��"�>�>�C�C�E�O��"� �/�/��#�F�G�,�	�(�7�7����#�	���$�Y�/�?���x��(�(�,�,�X�->�->�-B�-B�C��#�h�&8�&8��&J�J��#�+�+�1�!�+�D���0�0�6�6��,�,�%��~�-�
�	
�$�
���!�/�/�J�	�'�2�2�4�L�"*�!B�!B�!I�!I��%��!�+�� ,� 6� 6� 8�"J�"
��
	���(��)�)�F�2�	
�	����I��
�����N�N�@�@�!'�%��!�!3�%�(4�(>�(>�(@�	�
�	
�
�
�8�����(�(��	��:�:�?�?�A�
�,�-�G� �,�!2�!9�!9���&7�&C�&C��#��W�%��m?�B�C�L����(�(��0�0�6�6��,�,�"�?�3�-�
�	
�$�
���!�/�/�J��;�;�B�B� ��1�A�5�j�
C�
�	�
	���(��)�)�F�2�	
�	����N�N�:�:��_�-��1��	
�))��i�	��	��
�
���'�'�	��	��&�2�2�	��H�H�=�>���9�9�	��K�K��������	�I�!�L�N��I�I�a�L�L��	�sh�$M>�N�!AN�'N�AN5�>	N�
N�N	�N�N2�1N2�5(Q�!Q�3P�Q�% Q�Q)"rQ�loggingr`�uaclientrrrrr�uaclient.apir�2uaclient.api.u.pro.attach.auto.full_auto_attach.v1rr	�(uaclient.api.u.pro.status.is_attached.v1r
�uaclient.configr�uaclient.daemonr�uaclient.filesr
r�	getLogger�replace_top_level_logger_name�__name__r0rO�FLAG_FILE_PATHrZr,r4r@ru�r5r3�<module>r�s������=�=�5��B�$�8�/��g���:��:�:�8�D�E����(B��0�I�0�#�0�0	��	�l
�8�l
��l
r5

Zerion Mini Shell 1.0