oB]c@sdZddlmZddlmZddlmZddlmZddljj j Z ej e ZdZiedd 6ed d 6Zd Zd Zd ZdejfdYZdZeejffgZdZdS(s?Hetzner Cloud API Documentation. https://docs.hetzner.cloud/i(tlog(tnet(tsources(tutilNs!http://169.254.169.254/hetzner/v1s /metadatat metadata_urls /userdatat userdata_urli<itDataSourceHetznercBs/eZdZdZdZedZRS(tHetznercCstjj||||||_t|_tjtj|ddgit g|_ |j d|_ |j d|_ |j j dt|_|j j dt|_|j j dt|_d|_tj|_dS(Nt datasourceRRRtretriesttimeoutt wait_retry(Rt DataSourcet__init__tdistrotdicttmetadataRt mergemanydicttget_cfg_by_pathtBUILTIN_DS_CONFIGtds_cfgtmetadata_addresstuserdata_addresstgett MD_RETRIESR t MD_TIMEOUTR t MD_WAIT_RETRYR tNonet_network_configtDSMODE_NETWORKtdsmode(tselftsys_cfgRtpaths((sG/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceHetzner.pyR "s   c Csts tStj}tj|ddd_tj|jd|jd|j d|j }tj |j d|jd|j d|j }WdQX||_ ||_|d|jd<|d|jd <|jd d|jd <|jd d|jd <|jd d|_tS( Ns 169.254.0.1is169.254.255.255R t sec_betweenR s instance-idthostnameslocal-hostnamesnetwork-configs public-keyst vendor_data(t on_hetznertFalsetcloudnettfind_fallback_nictEphemeralIPv4Networkt hc_helpert read_metadataRR R R t read_userdataRt userdata_rawt metadata_fullRRRtvendordata_rawtTrue(Rtnictmdtud((sG/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceHetzner.pytget_data1s&     cCsB|jr|jS|jd}|s2tdn||_|jS(sConfigure the networking. This needs to be done each boot, since the IP information may have changed due to snapshot and/or migration. snetwork-configs'Unable to get meta-data from server....(RRt Exception(Rt _net_config((sG/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceHetzner.pytnetwork_configLs   (t__name__t __module__tdsnameR R4tpropertyR7(((sG/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceHetzner.pyRs  cCstjddkS(Nssystem-manufacturerR(Rt read_dmi_data(((sG/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceHetzner.pyR%_scCstj|tS(N(Rtlist_from_dependst datasources(tdepends((sG/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceHetzner.pytget_datasource_listjs(t__doc__t cloudinitRtloggingRR'RRt!cloudinit.sources.helpers.hetznerthelpersthetznerR*t getLoggerR8tLOGt BASE_URL_V1RRRRR RR%tDEP_FILESYSTEMR>R@(((sG/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceHetzner.pyts" A