//lib/python2.7/site-packages/cloudinit/sources/

OS : Linux

PHP Version : 7.4.33

Software : Apache/2.4.6 (CentOS) PHP/7.4.33

Information System : Linux apprendre2 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64

Disable Function : ó oBú]c@s:ddlZddlmZmZmZddlmZddlZddlm Z ddlm Z ddl mZddlmZddlmZdd lmZe jeƒZd efd „ƒYZd ejfd „ƒYZd„Zd„Zd„Zdd„Zd„Zeej ej!ffgZ"d„Z#dS(iÿÿÿÿN(t inet_ntoat getaddrinfotgaierror(tpack(t ec2_utils(tlog(tdhcp(tsources(t url_helper(tutiltCloudStackPasswordServerClientcBs)eZdZd„Zd„Zd„ZRS(s– Implements password fetching from the CloudStack password server. http://cloudstack-administration.readthedocs.org/ en/latest/templates.html#adding-password-management-to-your-templates has documentation about the system. This implementation is following that found at https://github.com/shankerbalan/cloudstack-scripts/ blob/master/cloud-set-guest-password-debian cCs ||_dS(N(tvirtual_router_address(tselfR ((sJ/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceCloudStack.pyt__init__*sc CsUtjddddddddd d j|ƒd j|jƒg ƒ\}}|jƒS( Ntwgets--quiets--triest3s --timeoutt20s--output-documentt-s--headersDomU_Request: {0}s{0}:8080(R tsubptformatR tstrip(R t domu_requesttoutputt_((sJ/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceCloudStack.pyt _do_request-s   cCsK|jdƒ}|dkrdS|dkr:tdƒ‚n|jdƒ|S(Ntsend_my_passwordttsaved_passwordt bad_requests-Error when attempting to fetch root password.(RR(RtNonet RuntimeError(R tpassword((sJ/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceCloudStack.pyt get_password9s   (t__name__t __module__t__doc__R RR (((sJ/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceCloudStack.pyR s   tDataSourceCloudStackcBsVeZdZdZdZd„Zd„Zd„Zd„Zd„Z e d„ƒZ RS( t CloudStackixi2cCstjj||||ƒtjj|jdƒ|_d|_tƒ|_ |j sat dƒ‚nd|j f|_ i|_ dS(NtcstlatestsNo virtual router found!s http://%s/( Rt DataSourceR tostpathtjointseed_dirtapi_vertget_vr_addresstvr_addrRtmetadata_addresstcfg(R tsys_cfgtdistrotpaths((sJ/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceCloudStack.pyR Ks   c Cs¼|jƒ}|jdkrtStj|jdƒg}tjƒ}tjd|d|jd|jdt j ƒ\}}|rt j d|ƒn#t j d|t tjƒ|ƒƒt|ƒS( Nislatest/meta-data/instance-idturlstmax_waitttimeoutt status_cbsUsing metadata source: '%s's>Giving up on waiting for the metadata from %s after %s seconds(tget_url_paramstmax_wait_secondstFalsetuhelpt combine_urlR0ttimet wait_for_urlttimeout_secondstLOGtwarningtdebugtcriticaltinttbool(R t url_paramsR5t start_timeturlt _response((sJ/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceCloudStack.pytwait_for_metadata_serviceWs      cCs|jS(N(R1(R ((sJ/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceCloudStack.pytget_config_objmscCssi}tj|d|jdƒrS|d|_|d|_tjd|jƒtSyñ|jƒsft St j ƒ}t j |j |jƒ|_t j|j |jƒ|_tjdtt j ƒ|ƒƒt|jƒ}y|jƒ}Wn'tk rtjtd|jƒn/X|r?itd6|d 6it d 6d 6|_ntSWn(tk rntjtd |jƒt SXdS( Ntbaset/s user-datas meta-datas%Using seeded cloudstack data from: %ss)Crawl of metadata service took %s secondss/Failed to fetch password from virtual router %st ssh_pwauthRtexpiretchpasswds(Failed fetching from metadata service %s(R tread_optional_seedR,t userdata_rawtmetadataRARCtTrueRKR;R>tec2tget_instance_userdataR-R0tget_instance_metadataRER R/R t ExceptiontlogexcR1(R tseed_retRHtpassword_clientt set_password((sJ/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceCloudStack.pyt _get_datapsD           cCs |jdS(Ns instance-id(RT(R ((sJ/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceCloudStack.pytget_instance_id—scCs |jdS(Nsavailability-zone(RT(R ((sJ/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceCloudStack.pytavailability_zonešs( R!R"tdsnamet url_max_waitt url_timeoutR RKRLR^R_tpropertyR`(((sJ/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceCloudStack.pyR$Cs   ' cCsIytddƒ}Wntk r4tjdƒdSX|dddSdS(Ns data-server.iPsDNS Entry data-server not foundii(RRRARCR(taddrinfo((sJ/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceCloudStack.pytget_data_serverŸs   cCstjdƒjƒ}xc|D][}|jdƒ}|ddkrttdt|ddƒƒƒ}tjd|ƒ|SqWdS( Ns/proc/net/routes it00000000st cloudinitRRVRtloggingt cloudinit.netRRRR<R t getLoggerR!RAtobjectR R(R$RfRoRuRRR.tDEP_FILESYSTEMt DEP_NETWORKRR(((sJ/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceCloudStack.pyts&  %\ ! *