| Server IP : 138.197.162.186 / Your IP : 216.73.216.184 Web Server : nginx/1.24.0 System : Linux ubuntu-s-1vcpu-512mb-10gb-tor1 6.8.0-71-generic #71-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 16:52:38 UTC 2025 x86_64 User : www-data ( 33) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /lib/python3/dist-packages/uaclient/clouds/__pycache__/ |
Upload File : |
�
��Jh� � �� � d dl Z d dlZd dlmZmZ d dlmZmZmZm Z m
Z
d dlmZ dZ
dZe
efZdZdZd Zd
ZdZdZd
ZdZedz Z ej2 e
j4 e� � Z G d� de� Zy)� N)�Any�Dict)�
exceptions�http�secret_manager�system�util)�PublicCloudAutoAttachInstancez169.254.169.254z[fd00:ec2::254]zhttp://{}/latest/api/tokenz0http://{}/latest/dynamic/instance-identity/pkcs7z3http://{}/latest/dynamic/instance-identity/documentz/sys/hypervisor/uuidz /sys/class/dmi/id/product_serialz/sys/class/dmi/id/product_uuid�21600zX-aws-ec2-metadata-tokenz-ttl-secondsc � � e Zd ZdZdZdefd�Ze ej e
j g d��� deee
f fd�� � Z ej e
j g d��� defd�� Zedefd �� Zd
� Z ej e
j g d��� d� � Zedefd
�� Zedefd�� Zdefd�Zdedefd�Zy)�AWSAutoAttachInstanceN�urlc � � t j ||d�� }|j dk( r|j S t j
|j |j �� �)N� )�headers�timeout�� ��code�body)r �readurlr r r �CloudMetadataError)�selfr r �responses �5/usr/lib/python3/dist-packages/uaclient/clouds/aws.py�_get_imds_url_responsez,AWSAutoAttachInstance._get_imds_url_response sJ � ��<�<��W�a�@���=�=�C���=�=� ��/�/��]�]�����
� )g �?r r )�retry_sleeps�returnc �� � | j � }t j | j � }| j ||�� }t
j j |� d|iS )N�r �pkcs7)�_request_imds_v2_token_headers�IMDS_URL�format�_ip_addressr r �secrets�
add_secret)r r r �imds_url_responses r �identity_docz"AWSAutoAttachInstance.identity_doc* s] � � �5�5�7���o�o�d�.�.�/�� �7�7��W�7�M�����)�)�*;�<��*�+�+r c �" � | j � }t j | j � } t j
| j
||�� � }|S # t j $ r"}t j d|� i cY d}~S d}~ww xY w)a
Get the instance identity doc associated with the current instance.
See
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/retrieve-iid.html
for more context.
@return: Dict containing the instance identity document.
r! z-Error decoding instance identity document: %sN)
r# �
_IMDS_IID_URLr% r&