/usr/lib/python3/dist-packages/uaclient/clouds/__pycache__
NameSizeModeActions
aws.cpython-310.pyc53770644editdlrm
azure.cpython-310.pyc28880644editdlrm
gcp.cpython-310.pyc45420644editdlrm
identity.cpython-310.pyc31230644editdlrm
lxd.cpython-310.pyc25450644editdlrm
__init__.cpython-310.pyc25820644editdlrm
Edit: /usr/lib/python3/dist-packages/uaclient/clouds/__pycache__/gcp.cpython-310.pyc (4542B)
o Ki(@sddlZddlZddlZddlZddlmZmZmZmZddl m Z m Z m Z m Z mZddlmZeeeZdZdZdZdZd Zd Zd gd d gddgddgddgdZGdddeZdS)N)AnyDictListOptional) exceptionshttpsecret_managersystemutil)PublicCloudAutoAttachInstancezhttp://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 Engine8045211386737108299602242772471989183074270702111529466285999592893498423827818678586103571931259286680341997832016008405569084766221760544822697860254168323874790319525)xenialbionicfocaljammynoblec@seZdZddZeejejgddde e e ffddZ ede fdd Z edefd d Zdee fd d ZdefddZdedefddZdS)GCPAutoAttachInstancecCs d|_dS)Netagselfr5/usr/lib/python3/dist-packages/uaclient/clouds/gcp.py__init__%s zGCPAutoAttachInstance.__init__)g?r") retry_sleepsreturncCsttjtddidd}|jdkrtj|jd|jiS|j d}|r1d| vr1t j |j|d t j |j|jd ) NMetadata-FlavorGoogler")headerstimeout identityTokenerror_descriptionzservice account) status_code error_msg)codebody)rreadurl TOKEN_URLr.rsecrets add_secretr/ json_dictgetlowerrGCPServiceAccountErrorCloudMetadataError)rresponse error_descrrr identity_doc,s    z"GCPAutoAttachInstance.identity_doccCsdS)Ngcprrrrr cloud_type?sz GCPAutoAttachInstance.cloud_typecCs*tjtrtt}t|krdSdS)z$This machine is a viable GCPInstanceTF)ospathexistsDMI_PRODUCT_NAMEr load_fileGCP_PRODUCT_NAMEstrip)r product_namerrr is_viableCs   zGCPAutoAttachInstance.is_viablecCsN|jd}t|ddd}t|d}|dididgS) zGet 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*.r"z===zutf-8googlecompute_engine license_id)r;base64urlsafe_b64decodesplitjsonloadsdecoder5)rtokenidentity identity_dictrrr get_licenses_from_identityMs  z0GCPAutoAttachInstance.get_licenses_from_identitycCs$tj}|tvrtddSdS)Nz0This series isn't supported for GCP auto-attach.FT)r get_release_infoseries GCP_LICENSESLOGinfo)rrVrrr should_poll_for_pro_license^s  z1GCPAutoAttachInstance.should_poll_for_pro_licensewait_for_changecCst}|r|t7}|jr|tj|jd7}tj|ddid}|jdkrHdd|jD}|j d|_t j }t |gD] }||vrEd Sqosz@GCPAutoAttachInstance.is_pro_license_present..rTFi) LICENSES_URLWAIT_FOR_CHANGEr LAST_ETAGformatrr0r. json_listr'r5r rUrVrWrXerrorr/rCancelProLicensePollingDelayProLicensePolling)rr[urlr9 license_idsrVlicrrr is_pro_license_presentes&    z,GCPAutoAttachInstance.is_pro_license_presentN)__name__ __module__ __qualname__r!propertyr retryrr8rstrrr;r=boolrFrrTrZrkrrrr r$s r)rKrNloggingr>typingrrrruaclientrrrr r uaclient.cloudsr getLoggerreplace_top_level_logger_namerlrXr1r`rarbrArCrWrrrrr s.