HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/uaclient/clouds/__pycache__/azure.cpython-310.pyc
o

nHJe�
�@s�ddlZddlZddlmZmZddlmZmZmZm	Z	ddl
mZe�e	�
e��ZdZdZedeeded	�Zd
ZdZdZd
ZGdd�de�ZdS)�N)�Any�Dict)�
exceptions�http�system�util)�AutoAttachCloudInstancez http://169.254.169.254/metadata/z
2020-09-01zattested/document?api-version=zinstance/compute?api-version=)�pkcs7�computez#/sys/class/dmi/id/chassis_asset_tagz%/var/lib/cloud/seed/azure/ovf-env.xmlz 7783-7084-3265-9085-8269-3286-77�
UBUNTU_PROc@s~eZdZeejejgd�d�dee	e
ffdd���Zede	fdd��Zede
fdd	��Zde
fd
d�Zde
de
fd
d�ZdS)�UAAutoAttachAzureInstance)�r
r
)�retry_sleeps�returncCspi}tt���D]-\}}tj|ddidd�}|jdkr$tj|j|jd��|dkr0|j	d||<q|j	||<q|S)	N�Metadata�truer
)�headers�timeout��)�code�bodyr	�	signature)
�sorted�	IMDS_URLS�itemsr�readurlrr�CloudMetadataErrorr�	json_dict)�self�	responses�key�url�response�r#�7/usr/lib/python3/dist-packages/uaclient/clouds/azure.py�identity_docs
�
�z&UAAutoAttachAzureInstance.identity_doccC�dS)N�azurer#�rr#r#r$�
cloud_type-�z$UAAutoAttachAzureInstance.cloud_typecCs2tj�t�rt�t�}t|��krdStj�t�S)z&This machine is a viable AzureInstanceT)	�os�path�exists�DMI_CHASSIS_ASSET_TAGr�	load_file�AZURE_CHASSIS_ASSET_TAG�strip�AZURE_OVF_ENV_FILE)r�chassis_asset_tagr#r#r$�	is_viable1s

z#UAAutoAttachAzureInstance.is_viablecCr&)NTr#r(r#r#r$�should_poll_for_pro_license:r*z5UAAutoAttachAzureInstance.should_poll_for_pro_license�wait_for_changec
Cs�|rt���t�dd�}ztj|ddid�}Wnty,}z	t�|�t���d}~ww|j	dkr<t�|j
�t���|j�d�tkS)Nr
�rr)rr�licenseType)
r�CancelProLicensePollingr�getrr�OSError�LOG�errorrrr�AZURE_PRO_LICENSE_TYPE)rr6r!r"�er#r#r$�is_pro_license_present>s
��
z0UAAutoAttachAzureInstance.is_pro_license_presentN)�__name__�
__module__�__qualname__�propertyr�retryrrr�strrr%r)�boolr4r5r@r#r#r#r$rsr)�loggingr+�typingrr�uaclientrrrr�uaclient.cloudsr�	getLogger�replace_top_level_logger_namerAr<�
IMDS_BASE_URL�API_VERSIONrr.r2r0r>rr#r#r#r$�<module>s 

�