ó oBú]c@s´ddlmZddlmZddlmZddljjjZej e ƒZ idd6Z 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|j d|j ƒ}||_ |jd|ƒ|jd<|jd|ƒ|jd<|jd ƒ|jd <|jd ƒ|jd <|jd d ƒ|jd<|jddƒ|_|jddƒ|_|r7tj|ƒntS(Ns'Running on digital ocean. droplet_id=%sRt sec_betweenRt droplet_ids instance-idthostnameslocal-hostnamet interfacest public_keyss public-keystregiontdefaulttavailability_zonet vendor_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....tdnst nameservers( 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_dependst datasources(tdepends((sL/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceDigitalOcean.pytget_datasource_listqs(t cloudinitRtloggingRRt&cloudinit.sources.helpers.digitaloceanthelperst digitaloceanRt getLoggerRCR-RRRRR5RR RtDEP_FILESYSTEMRHRJ(((sL/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceDigitalOcean.pyt s O