Viewing File: /usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceDigitalOcean.pyo

ó
oBú]c@s´ddlmZddlmZddlmZddljjjZej	e
ƒZidd6ZdZ
dZdZeZd	ejfd
„ƒYZeejffgZd„ZdS(iÿÿÿÿ(tlog(tsources(tutilNs'http://169.254.169.254/metadata/v1.jsontmetadata_urliitDataSourceDigitalOceancBsAeZdZd„Zd„Zd„Zd„Zed„ƒZRS(tDigitalOceancCsØtjj||||ƒ||_tƒ|_tjtj|ddgiƒt	gƒ|_
|j
d|_|j
jdt
ƒ|_|j
jdtƒ|_|j
jdtƒ|_|j
jdtƒ|_d|_dS(Nt
datasourceRRtretriesttimeoutt	use_ip4LLt
wait_retry(Rt
DataSourcet__init__tdistrotdicttmetadataRt
mergemanydicttget_cfg_by_pathtBUILTIN_DS_CONFIGtds_cfgtmetadata_addresstgett
MD_RETRIESRt
MD_TIMEOUTRt
MD_USE_IPV4LLR	t
MD_WAIT_RETRYR
tNonet_network_config(tselftsys_cfgR
tpaths((sL/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceDigitalOcean.pyR!s	cCs
tjƒS(N(t	do_helpertread_sysinfo(R((sL/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceDigitalOcean.pyt_get_sysinfo/scCs;|jƒ\}}|stStjd|ƒd}|jrJtjƒ}ntj|j	d|j
d|jd|jƒ}||_
|jd|ƒ|jd<|jd|ƒ|jd<|jd	ƒ|jd	<|jd
ƒ|jd<|jdd
ƒ|jd<|jddƒ|_|jddƒ|_|r7tj|ƒntS(Ns'Running on digital ocean. droplet_id=%sRtsec_betweenRt
droplet_idsinstance-idthostnameslocal-hostnamet
interfacestpublic_keysspublic-keystregiontdefaulttavailability_zonetvendor_datat	user_data(R!tFalsetLOGtinfoRR	Rtassign_ipv4_link_localt
read_metadataRRR
Rt
metadata_fullRRtvendordata_rawtuserdata_rawtdel_ipv4_link_localtTrue(Rtis_doR#t
ipv4LL_nictmd((sL/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceDigitalOcean.pyt	_get_data2s*		cCstj|jƒdƒS(Nssystem-serial-number(Rtinstance_id_matches_system_uuidtget_instance_id(RR((sL/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceDigitalOcean.pytcheck_instance_idQscCsq|jr|jS|jjdƒ}tj|ƒ|sDtdƒ‚n|jdd}tj||ƒ|_|jS(s¥Configure the networking. This needs to be done each boot, since
           the IP information may have changed due to snapshot and/or
           migration.
        R%s'Unable to get meta-data from server....tdnstnameservers(	RRRR-tdebugt	ExceptionR1Rtconvert_network_configuration(RR%R>((sL/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceDigitalOcean.pytnetwork_configUs	
(	t__name__t
__module__tdsnameRR!R9R<tpropertyRB(((sL/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceDigitalOcean.pyRs				cCstj|tƒS(N(Rtlist_from_dependstdatasources(tdepends((sL/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceDigitalOcean.pytget_datasource_listqs(t	cloudinitRtloggingRRt&cloudinit.sources.helpers.digitaloceanthelperstdigitaloceanRt	getLoggerRCR-RRRRR5RRRtDEP_FILESYSTEMRHRJ(((sL/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceDigitalOcean.pyt<module>	s
O
Back to Directory File Manager