f8 $ddlZddlZddlmZddlmZmZddlmZm Z ddl m Z ddl m Z ejeZdZGdd e jZd Zd ZGd d eZeej,ffeej,ej.ffgZdZy)N)List)dmisources) EventScope EventType) DataSourceEc2)DataSourceHostnamezAlibaba Cloud ECScfeZdZUdZdgZdZgZeee d<e dZ fdZ d dZ dZd ZxZS) DataSourceAliYunAliYunzhttp://100.100.100.200z 2016-01-01extended_metadata_versionscy)NzX-aliyun-ecs-metadata-tokenselfs D/usr/lib/python3/dist-packages/cloudinit/sources/DataSourceAliYun.pyimdsv2_token_put_headerz(DataSourceAliYun.imdsv2_token_put_headers,ctt| |||tj|j |_|j t jjtjyN) superr __init__copydeepcopydefault_update_eventsrNETWORKaddrBOOT)rsys_cfgdistropaths __class__s rrzDataSourceAliYun.__init__sQ .wF%)]]43M3M%N" "":#5#56::9>>Jrc`|jjd}d}|d}d}t||S)NhostnameFzlocalhost.localdomainT)metadatagetr )rfqdn resolve_ip metadata_onlyr$ is_defaults r get_hostnamezDataSourceAliYun.get_hostname$s8==$$Z0  .HJ!(J77rcLt|jjdiS)Nz public-keys)parse_public_keysr%r&rs rget_public_ssh_keysz$DataSourceAliYun.get_public_ssh_keys,s !2!2="!EFFrc~trtjjStjjSr) _is_aliyunEC2 CloudNamesALIYUNNO_EC2_METADATArs r_get_cloud_namez DataSourceAliYun._get_cloud_name/s' <>>(( (>>11 1r)FFF)__name__ __module__ __qualname__dsname metadata_urlsmin_metadata_versionr rstr__annotations__propertyrrr+r.r5 __classcell__)r"s@rr r sQ F-.M(,.S .--K 8G2rr c:tjdtk(S)Nzsystem-product-name)r read_dmi_dataALIYUN_PRODUCTrrrr0r06s   2 3~ EErcg}|jD]\}}t|tr |j|j 6t|t r|j |Xt|tsi|jdg}t|tr |j|j t|t s|j ||S)Nz openssh-key) items isinstancer<appendstriplistextenddictr&) public_keyskeys_key_idkey_bodykeys rr-r-:s D(..0 ! h $ KK( ) $ ' KK ! $ ',,}b1C#s# CIIK(C& C  ! KrceZdZdZdZy)DataSourceAliYunLocalayDatasource run at init-local which sets up network to query metadata. In init-local, no network is available. This subclass sets up minimal networking with dhclient on a viable nic so that it can talk to the metadata service. If the metadata service provides network configuration then render the network configuration for that instance based on metadata. TN)r6r7r8__doc__perform_dhcp_setuprrrrQrQJsrrQc6tj|tSr)rlist_from_depends datasources)dependss rget_datasource_listrX]s  $ $Wk ::r)rloggingtypingr cloudinitrrcloudinit.eventrrcloudinit.sourcesrr1r getLoggerr6LOGrBr r0r-rQDEP_FILESYSTEM DEP_NETWORKrVrXrrrrbs "120g!$"2s(("2JF  , W3356..0C0CDE ;r