Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.52 (Ubuntu)
System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64
User : www-data ( 33)
PHP Version : 8.1.2-1ubuntu2.21
Disable Function : NONE
Directory :  /lib/python3/dist-packages/uaclient/clouds/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/uaclient/clouds/__pycache__/gcp.cpython-310.pyc
o

��pfF�@s�ddlZddlZddlZddlZddlmZmZmZmZddl	m
Z
mZmZm
Z
mZddlmZe�e�e��ZdZdZdZdZd	Zd
Zddd
ddd�ZGdd�de�ZdS)�N)�Any�Dict�List�Optional)�
exceptions�http�secret_manager�system�util)�AutoAttachCloudInstancez�http://metadata/computeMetadata/v1/instance/service-accounts/default/identity?audience=contracts.canonical.com&format=full&licenses=TRUEzThttp://metadata.google.internal/computeMetadata/v1/instance/licenses/?recursive=truez&wait_for_change=truez&last_etag={etag}z/sys/class/dmi/id/product_namezGoogle Compute Engine�8045211386737108299�6022427724719891830�599959289349842382�2592866803419978320�2176054482269786025)�xenial�bionic�focal�jammy�noblec@s�eZdZdd�Zeejejgd�d�de	e
effdd���Zede
fdd	��Z
edefd
d��Zdee
fdd
�Zdefdd�Zdedefdd�ZdS)�UAAutoAttachGCPInstancecCs
d|_dS)N��etag��self�r�5/usr/lib/python3/dist-packages/uaclient/clouds/gcp.py�__init__%s
z UAAutoAttachGCPInstance.__init__)g�?�r)�retry_sleeps�returncCsttjtddidd�}|jdkrtj�|j�d|jiS|j�	d�}|r1d|�
�vr1tj|j|d	��tj
|j|jd
��)N�Metadata-Flavor�Googler)�headers�timeout���
identityToken�error_descriptionzservice account)�status_code�	error_msg)�code�body)r�readurl�	TOKEN_URLr*r�secrets�
add_secretr+�	json_dict�get�lowerr�GCPServiceAccountError�CloudMetadataError)r�response�
error_descrrr�identity_doc,s
�

��z$UAAutoAttachGCPInstance.identity_doccCsdS)N�gcprrrrr�
cloud_type?sz"UAAutoAttachGCPInstance.cloud_typecCs*tj�t�rt�t�}t|��krdSdS)z$This machine is a viable GCPInstanceTF)�os�path�exists�DMI_PRODUCT_NAMEr	�	load_file�GCP_PRODUCT_NAME�strip)r�product_namerrr�	is_viableCs

z!UAAutoAttachGCPInstance.is_viablecCsN|jd}t�|�d�dd�}t�|�d��}|�di��di��dg�S)	z�Get a list of licenses from the GCP metadata.

        Instance identity token (jwt) carries a list of licenses
        associated with the instance itself.

        Returns an empty list if licenses are not present in the metadata.
        r&�.rz===zutf-8�google�compute_engine�
license_id)r7�base64�urlsafe_b64decode�split�json�loads�decoder1)r�token�identity�
identity_dictrrr�get_licenses_from_identityMs

�z2UAAutoAttachGCPInstance.get_licenses_from_identitycCs$t��j}|tvrt�d�dSdS)Nz0This series isn't supported for GCP auto-attach.FT)r	�get_release_info�series�GCP_LICENSES�LOG�info)rrRrrr�should_poll_for_pro_license^s


z3UAAutoAttachGCPInstance.should_poll_for_pro_license�wait_for_changecCs�t}|r|t7}|jr|tj|jd�7}tj|ddid�}|jdkr=dd�|jD�}|j	�
d�|_t��j
}t�
|�|vSt�|j�|jd	krLt���t���)
Nrr!r")r#r%cSsg|]}|d�qS)�idr)�.0�licenserrr�
<listcomp>oszBUAAutoAttachGCPInstance.is_pro_license_present.<locals>.<listcomp>ri�)�LICENSES_URL�WAIT_FOR_CHANGEr�	LAST_ETAG�formatrr,r*�	json_listr#r1r	rQrRrSrT�errorr+r�CancelProLicensePolling�DelayProLicensePolling)rrW�urlr5�license_idsrRrrr�is_pro_license_presentes


z.UAAutoAttachGCPInstance.is_pro_license_presentN)�__name__�
__module__�__qualname__r�propertyr
�retryrr4r�strrr7r9�boolrBrrPrVrfrrrrr$s	r)rGrJ�loggingr:�typingrrrr�uaclientrrrr	r
�uaclient.cloudsr�	getLogger�replace_top_level_logger_namergrTr-r\r]r^r=r?rSrrrrr�<module>s.���	

Spamworldpro Mini