ó 'KXc@süddlZddlZddlmZddlmZddlmZddlmZ ddlm Z ddl m Z ddl mZejeƒZd ejfd „ƒYZd „Zd „Zd „Zd„ZeejejffgZd„ZdS(iÿÿÿÿN(t ec2_utils(tlog(tsources(t url_helper(tutil(t inet_ntoa(tpacktDataSourceCloudStackcBsDeZd„Zd„Zd„Zd„Zd„Zed„ƒZRS(cCsltjj||||ƒtjj|jdƒ|_d|_tƒ}|s[t dƒ‚nd||_ dS(NtcstlatestsNo virtual router found!s http://%s/( Rt DataSourcet__init__tostpathtjointseed_dirtapi_vertget_vr_addresst RuntimeErrortmetadata_address(tselftsys_cfgtdistrotpathstvr_addr((sS/opt/freeware/lib/python2.7/site-packages/cloudinit/sources/DataSourceCloudStack.pyR *s  cCsÄ|j}|si}nd}yt|jd|ƒƒ}Wn$tk r`tjtd|ƒnX|dkrqtSd}yt|jd|ƒƒ}Wn$tk r¹tjtd|ƒnX||fS(Nixtmax_waits Failed to get max wait. using %sii2ttimeoutsFailed to get timeout, using %s(tds_cfgtinttgett ExceptionRtlogexctLOGtFalse(RtmcfgRR((sS/opt/freeware/lib/python2.7/site-packages/cloudinit/sources/DataSourceCloudStack.pyt_get_url_settings5s      c Cs³|j}|si}n|jƒ\}}|jdg}tjƒ}tjd|d|d|dtjƒ}|r†tjd|ƒn#tj d|t tjƒ|ƒƒt |ƒS(Ns/latest/meta-data/instance-idturlsRRt status_cbsUsing metadata source: '%s's>Giving up on waiting for the metadata from %s after %s seconds( RR#Rttimetuhelpt wait_for_urlR twarntdebugtcriticalRtbool(RR"RRR$t start_timeturl((sS/opt/freeware/lib/python2.7/site-packages/cloudinit/sources/DataSourceCloudStack.pytwait_for_metadata_serviceJs    cCsüi}tj|d|jdƒrS|d|_|d|_tjd|jƒtSyz|jƒsft St j ƒ}t j |j |jƒ|_t j|j |jƒ|_tjdtt j ƒ|ƒƒtSWn(tk r÷tjtd|jƒt SXdS(Ntbaset/s user-datas meta-datas%Using seeded cloudstack data from: %ss)Crawl of metadata service took %s secondss(Failed fetching from metadata service %s(Rtread_optional_seedRt userdata_rawtmetadataR R*tTrueR/R!R&tec2tget_instance_userdataRRtget_instance_metadataRRR(Rtseed_retR-((sS/opt/freeware/lib/python2.7/site-packages/cloudinit/sources/DataSourceCloudStack.pytget_data_s*          cCs |jdS(Ns instance-id(R4(R((sS/opt/freeware/lib/python2.7/site-packages/cloudinit/sources/DataSourceCloudStack.pytget_instance_idvscCs |jdS(Nsavailability-zone(R4(R((sS/opt/freeware/lib/python2.7/site-packages/cloudinit/sources/DataSourceCloudStack.pytavailability_zoneys( t__name__t __module__R R#R/R:R;tpropertyR<(((sS/opt/freeware/lib/python2.7/site-packages/cloudinit/sources/DataSourceCloudStack.pyR)s     cCstjdƒjƒ}xc|D][}|jdƒ}|ddkrttdt|ddƒƒƒ}tjd|ƒ|SqWdS( Ns/proc/net/routes it00000000ss  U