\`fqddlZddlZddlZddlZddlmZmZddlmZm Z m Z ddlm Z ddlm Z mZddlmZddlmZmZddlmZdd lmZdd lmZdd lmZej8eZee j@gZ!d Z"d Z#GddZ$dZ%e$jLe$jNgZ(dZ)Gdde jTZ+Gdde+Z,dZ-dZ.dZ/dZ0dZ1dZ2dZ3dZ4dZ5dZ6d Z7d!ee8efd"ee8d#ee8e9ffd$Z:d%e;d&e8d'e;d(ed)ed-Z?d.Z@e,e jffe+e je jffgZCd/ZDy)1N)DictList)dminetsources) url_helper)utilwarnings)Distro) EventScope EventType)netplan)NoDHCPLeaseError)EphemeralIPNetwork)ec2) datasourceEc2 strict_idwarnc,eZdZdZdZdZdZdZdZdZ dZ y ) CloudNamesaliyunaws brightboxzstacke24cloudoutscaleunknownzno-ec2-metadataN) __name__ __module__ __qualname__ALIYUNAWS BRIGHTBOXZSTACKE24CLOUDOUTSCALEUNKNOWNNO_EC2_METADATAA/usr/lib/python3/dist-packages/cloudinit/sources/DataSourceEc2.pyrr#s. F CI FHHG(Or+rc@|jdk(xrd|jvS)Nzmeta-data/tags/)codeurl) exceptions r,skip_404_tag_errorsr23s >>S G%6)--%GGr+zS ENV{ID_NET_DRIVER}=="vif|ena|ixgbevf", GOTO="cloudinit_hook" GOTO="cloudinit_end" cDeZdZUdZgdZdZgdZeee d<dZ dZ dZ e jZd Zej$ej(ej*ej,ej.hiZej$ej(ej.hiZeZfd Zd ed dffd ZdZdZ dZ!e"dZ#e"dZ$e"dZ%e"dZ&e"dZ'e"dZ(e"dZ)dZ*dZ+dZ,dZ-dZ.e"dZ/e"dZ0dZ1e"d Z2d!Z3d'd"Z4d#Z5d$Z6d'd%Z7d(d&Z8xZ9S)) DataSourceEc2r)zhttp://169.254.169.254zhttp://[fd00:ec2::254]zhttp://instance-data.:8773z 2009-04-04)z 2021-03-23z 2018-09-24z 2016-09-02extended_metadata_versionsx2NFc>tt| |||d|_yN)superr4__init__metadata_address)selfsys_cfgdistropaths __class__s r,r;zDataSourceEc2.__init__us mT+GVUC $r+ci_pkl_versionreturnc:t||t|_yr9)r: _unpickle_EXTRA_HOTPLUG_UDEV_RULESextra_hotplug_udev_rules)r=rBrAs r,rEzDataSourceEc2._unpickleys .)(A%r+ctS)z5Return the cloud name as identified during _get_data.)identify_platformr=s r,_get_cloud_namezDataSourceEc2._get_cloud_name}s  ""r+cttj|jtt d\}}t jd||j|j|dk(r|jtjk(ry|jtjk(ry|jrtjrt jdy t|j |j j"dd5}|j$rd|j$nd }tj&t jd ||j( |_dddn5tj&t jd |j( |_|j*sy|j*j/d d|_|j*j/d d|_|j*j/dij/dij/di|_y#1swYxYw#t,$rYywxYw)N)rNz0strict_mode: %s, cloud_name=%s cloud_platform=%strueFz1FreeBSD doesn't support running dhclient with -sfT)ipv4ipv6 zCrawl of metadata servicelogfuncmsgfunc meta-data user-datadynamicinstance-identitydocument)read_strict_moder get_cfg_by_pathr>STRICT_ID_PATHSTRICT_ID_DEFAULTLOGdebug cloud_nameplatformrr(r)perform_dhcp_setup is_FreeBSDrr?fallback_interface state_msglog_timecrawl_metadata_crawled_metadatargetmetadata userdata_rawidentity)r= strict_mode_sleepnetwrfs r, _get_datazDataSourceEc2._get_datas.   n.?     V >  OO MM  & T__ 8J8J%J __ : : :  " "  MN 'KKKK22   8<!DNN#3 4BI-1]] # 7 {C!00.D*  &*]] /((&D " %%..22;E  2266{DI  " " & &y" 5 S$b ) SR  =  $  s+-H9AH-H9-H62H99 IIc|jsy|jjdijdi}|jdijD] \}}d|vs yy)z6Report if this instance type is Ec2 Classic (non-vpc).Fnetwork interfacesmacszvpc-idT)rkrjitems)r= ifaces_md_macmac_datas r,is_classic_instancez!DataSourceEc2.is_classic_instancesh}}MM%%i488rJ 'mmFB7==? ND(8# r+cR|jsy|jjdS)Nzami-launch-index)rkrjrJs r, launch_indexzDataSourceEc2.launch_indexs"}}}}  !344r+ct|ds#tjj|_|js#tjj|_|jS)N_platform_type)hasattrr4dsnamelowerr~rJs r,rbzDataSourceEc2.platformsRt-."/"6"6"<"<">D """/"6"6"<"<">D """r+cy)Nzlatest/api/tokenr*rJs r,api_token_routezDataSourceEc2.api_token_routes!r+cy)N21600r*rJs r,imdsv2_token_ttl_secondsz&DataSourceEc2.imdsv2_token_ttl_secondssr+cy)NzX-aws-ec2-metadata-tokenr*rJs r,imdsv2_token_put_headerz%DataSourceEc2.imdsv2_token_put_headers)r+c |jdzS)Nz -ttl-seconds)rrJs r,imdsv2_token_req_headerz%DataSourceEc2.imdsv2_token_req_headers++n<> @ 6Q?? @s"C  C?C::C?c|jtjk(rt|ddsg|j }t j ||j|j|j|jjdi|_ |jjd|jdS|jdS)Nrm headers_cbr exception_cbrZ instanceIdz instance-id)rarr#getattrrrget_instance_identityr<rr_refresh_stale_aws_token_cbrjrmrk)r= api_versions r,get_instance_idzDataSourceEc2.get_instance_id s ??jnn ,4T2#;;= # 9 9))#00#'#;#;!%!A!A ! #j"%  ==$$dmmM: ==/ /r+c |jtvryg}i}|j}d}|D]*}dj||}|j ||||<,t j dd}d}|j} tj|| j| jt j|j|j||jd \}}|r|r ||_||Sy#tj $rY&wxYw)aGet an API token for EC2 Instance Metadata Service. On EC2. IMDS will always answer an API token, unless the instance owner has disabled the IMDS HTTP endpoint or the network topology conflicts with the configured hop-limit. NPUT{0}/{1}zFetching Ec2 IMDSv2 API TokenF) urlsmax_waittimeout status_cbrrrequest_methodrconnect_synchronously)ra IDMSV2_SUPPORTED_CLOUD_PLATFORMSrrappendr_r`get_url_paramsr wait_for_urlmax_wait_secondstimeout_secondswarningr_imds_exception_cbrr _api_token) r=mdurlsrurl2baseurl_pathrr0curresponse url_paramss r,_maybe_fetch_api_tokenz$DataSourceEc2._maybe_fetch_api_tokens ??"B B '' C""31C KK HSM 12((*  !..#44"22++,,!44-#77&+ MC 8&DOC= ~~   s?A!C11DDc |j}|j}|jdkry|jd|j}|Dcgc]}t j |s|}}t|t|k7r4tjdtt|t|z t|r|}n!tjd|j}|j|}|s|jtvrg}i}dj!|j"} d} |D]*} d j!| | } |j%| | || <,t'j&} t)j*||j|j,tj|j.|j0| \} }| r|| }|r2||_tjd |j2t9|S|jtvr tjd t9|Stj5d t7t'j& z t9|Scc}w)NrF metadata_urlsz,Removed the following from metadata urls: %sz+Empty metadata url list! using default listz{ver}/meta-data/instance-id)verGETr)rrrrrrrzUsing metadata source: '%s'z)IMDS's HTTP endpoint is probably disabledz(Giving up on md from %s after %s seconds)ds_cfgrrrjrr is_resolvable_urlsetr_r`listlenrrrarrrrtimerrrrrr<criticalintbool)r=mcfgrrxfilteredr<rrrrr0r start_time_s r,wait_for_metadata_servicez'DataSourceEc2.wait_for_metadata_serviceOs={{((*  & &! +/4+=+=>%C!)?)?)BACC x=CK ' II>c&kCM13  x=F KKE F''F 66v> !'GGDH4;;--<H#N $&&sH5 C #  $ J''#44"22++#77,,-FC#+C= $4D ! II3T5J5J K$%%__ @ @ KKC D$%% LL:DIIK*,-  $%%}Ds I4(I4c4d|jvryd}|jd}t|tstj d|y|j D]\}}||k(r|}n|dk(s|dk(s|}|tj d|y|}|j dsd|z}tjj|r|S|jtjj|}|rtj d|||S|dk(ry|S) Nzblock-device-mappingz+block-device-mapping not a dictionary: '%s' ephemeral ephemeral0z Unable to convert %s to a device/z/dev/%szRemapped device name %s => %s) rk isinstancedictr_r`rv startswithospathexists _remap_devicebasename)r=namefoundbdmentnamedeviceofoundremappeds r,device_name_to_devicez#DataSourceEc2.device_name_to_devices " 6mm23#t$ IICS I"yy{ OGV$+%$,*>   = II8$ ?$%E 77>>% L%%bgg&6&6u&=>  II5uh GO <  r+c |jtjk(r,|jj d|j ddS|j ddS#t $rYywxYw)NavailabilityZone placementzavailability-zone)rarr#rmrjrkKeyErrorrJs r,availability_zonezDataSourceEc2.availability_zonesl *..0}}((&MM+./BC }}[12EFF  sAA A A)(A)c|jtjk(r:|jj d}|j r|s|j dd}|S|j }||ddSy)Nregion)rarr#rmrjr)r=razs r,rzDataSourceEc2.regionsf ??jnn ,]]&&x0F%%f//4M''B~#2wr+c|sy|jtjk(r*tt j |t t|yyr9)rarr(warn_if_necessaryr r\r]r^)r=cfgis_new_instances r,activatezDataSourceEc2.activates=  ??j00 0 $$S.:KL  1r+c ,|jtjk7r |jS|jtj dyd}t d|jvxr|jtjk(}|rEtjdtjtjd|j|jj}|jj!d}t#|t$rt'||j|tj(|j*dd }|j-rt/j0|j2|_|j2t4j6j9t:j<|j2t4j6j9t:j>ntj d |||_|jS) z@Return a network config dict for rendering ENI or netplan files.Nz8Unexpected call to network_config when metadata is None.rszPMetadata 'network' not present: Refreshing stale metadata from prior to upgrade.zRe-crawl of metadata servicerRapply_full_imds_network_configT) fallback_nicfull_network_configz%Metadata 'network' key not valid: %s.) _network_configrUNSETrkr_rrrarr#r`r rgget_datar?rerjrr#convert_ec2_metadata_network_configget_cfg_option_boolrrzcopydeepcopydefault_update_eventsr NETWORKaddr BOOT BOOT_LEGACY)r=resultno_network_metadata_on_awsifacenet_mds r,network_configzDataSourceEc2.network_configs   7== 0'' ' == KKJ %) T]] * 2:>>1& " & IID  MM 2]]   ..""9- fd #9 "$($<$<KK!A4% F'')-1]]...***:+=+=>BBNN**:+=+=>BB)) KK? H%###r+c(|jsiS|j}|j}i}|jtvr|j }|j }d}n.|jtjk(r dx}}t}ndx}x}} tj||j|j||}tj||d<tj ||j|j||||d<|jtj"k(r5tj$||j|j||}d|i|d<||d <|S#t&$r*tj(t*d|jicYSwxYw) zCrawl metadata service when available. @returns: Dictionary of crawled metadata content containing the keys: meta-data, user-data and dynamic. NrrW)rrrretrieval_exception_ignore_cbrVrYrXz'Failed reading from metadata address %s_metadata_api_version)rrrrarr#_skip_or_refresh_stale_aws_token_cbrr'r2rget_instance_userdatar<rr maybe_b64decodeget_instance_metadatar#r Exceptionlogexcr_) r=rredactcrawled_metadataexc_cb exc_cb_udskip_cb raw_userdatarms r,rhzDataSourceEc2.crawl_metadata-s --/I335 )) ??> >55F@@IG __ 3 3 3!% %FY)G+/ /F /Y 44%%,,%& L-1,@,@,N [ ),/,E,E%%,,%#.5 - [ )*..044))#00#)!' 0CH.M +5@01  KK9%%  I  s C E0FFc|jtvry| |j}tj d|j |i}dj |j|j} tj|||jd}|jS#tj$r!}tjd||Yd}~yd}~wwxYw)zRequest new metadata API token. @param seconds: The lifetime of the token in seconds @return: The API token or None if unavailable. Nz!Refreshing Ec2 metadata API tokenz{}/{}r)rrrz/Unable to get API token: %s raised exception %s)rarrr_r`rrr<rrrrrrcontents)r=secondsrequest_header token_urlrrs r,_refresh_api_tokenz DataSourceEc2._refresh_api_tokenes ??"B B ?33G 5666@NN4#8#8$:N:NO  }}&#77$ H   ~~  KKA9a   s,#BC.C  Ccvtjtj||}|sy|j||S)zSCallback will not retry on SKIP_USERDATA_CODES or if no token is available.F)rskip_retry_on_codesSKIP_USERDATA_CODESr)r=rTr1retrys r,r z1DataSourceEc2._skip_or_refresh_stale_aws_token_cbs<''  # #S) //Y??r+ct|tjr+|jdk(rtj dd|_y)z=Exception handler for Ec2 to refresh token if token is stale.iz+Clearing cached Ec2 API token due to expiryNT)rrrr/r_r`rr=rTr1s r,rz)DataSourceEc2._refresh_stale_aws_token_cbs2 i 0Y^^s5J IIC D"DOr+ct|tjrZ|jrM|jdk\r=|jdk(rtj d|tj d|yyy)a2Fail quickly on proper AWS if IMDSv2 rejects API token request Guidance from Amazon is that if IMDSv2 had disabled token requests by returning a 403, or cloud-init malformed requests resulting in other 40X errors, we want the datasource detection to fail quickly without retries as those symptoms will likely not be resolved by retries. Exceptions such as requests.ConnectionError due to IMDS being temporarily unroutable or unavailable will still retry due to the callsite wait_for_url. iizLEc2 IMDS endpoint returned a 403 error. HTTP endpoint is disabled. Aborting.z2Fatal error while requesting Ec2 IMDSv2 API tokensN)rrrr/r_rr#s r,rz DataSourceEc2._imds_exception_cbsl i 0~~)..C"7>>S(KK? KKL #8~ 1r+c|jtvriS|j|ji}|j|vr|S|j s#|j |_|j siS|j|j iS)zReturn a dict of headers for accessing a url. If _api_token is unset on AWS, attempt to refresh the token via a PUT and then return the updated token header. )rarrrrrrr)r=r0request_token_headers r,rzDataSourceEc2._get_headerss ??"B BI  ( ($*G*G    3 &' '#557DO?? ,,doo>>r+r9)rQ):rr r!rrrr5rstr__annotations__ url_max_wait url_timeoutrrrrrcr rr BOOT_NEW_INSTANCErrHOTPLUGsupported_update_eventsrrFrGr;rrErKrqrzpropertyr|rbrrrrrrrrrrrrrrrhrr rrr __classcell__rAs@r,r4r4Bs FM( -S LKJmmO   ' ' NN  ! !        ' '     9%BBB#6p 55 ##""**==LL)>0(0dG&R1f    ;$;$z6 p!:@ 6?r+r4c&eZdZdZdZfdZxZS)DataSourceEc2LocalayDatasource 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. Tctjtjf}|j|vr"tj d||jyt t|#S)Nz+Local Ec2 mode only supported on %s, not %sF) rr#r'rar_r`r:r2r)r=supported_platformsrAs r,rzDataSourceEc2Local.get_datasT)~~z/B/BC ??"5 5 II=#  '799r+)rr r!__doc__rcrr/r0s@r,r2r2s : :r+r2ct t|S#t$r!}tj||cYd}~Sd}~wwxYwr9)parse_strict_mode ValueErrorr_r)cfgvaldefaultrs r,r[r[s2 ((  As 7277c|dury|dury|sy|jd\}}}|dvrtd|d |d |r t|}||fSd}||fS#t$r}td |d |d |d}~wwxYw) NT)rMNF)falseN)rr,)rMr<rzInvalid mode 'z' in strict_id setting 'z+': Expected one of 'true', 'false', 'warn'.zInvalid sleep 'z': not an integer) partitionr8r)r9modersleeprs r,r7r7s~  %%c*ND!U ,,:> H    JE ; ; &"  s A A2A--A2c t|\}}|dk(ryt j d|d|y#t$r}tj|Yd}~yd}~wwxYw)Nr< non_ec2_mdT)r?r@)r7r8r_rr show_warning)r9rr?r@rs r,rrsU'/ e  w ,$eD  As0 AAAc4|ddk(rtjSy)N product_namezAlibaba Cloud ECS)rr"datas r,identify_aliyunrHs! N22   3r+cr|djdr#|ddk(s |d|dk(rtjSy)Nuuidr uuid_source hypervisorserial)rrr#rFs r, identify_awsrNs= F|u% ]|+tF|tH~/M~~ r+cL|djdrtjSy)NrMz.brightbox.com)endswithrr$rFs r,identify_brightboxrQ#s& H~/0###1r+cL|djdrtjSy)N asset_tagz .zstack.io)rPrr%rFs r,identify_zstackrT(s& K!!,/   0r+c4|ddk(rtjSy)Nvendorr)rr&rFs r,identify_e24cloudrW-s H~#"""$r+c~|ddjk(r'|ddjk(rtjSyy)NrEz3DS Outscale VMrVz 3DS Outscale)rrr'rFs r,identify_outscalerY2sD ^ 1 7 7 99 Nn224 4""" 5 :r+ct}ttttt t df}|D]} ||}|r|cSy#t$r"}tjd|||Yd}~;d}~wwxYw)Nc"tjSr9)rr()rs r,z#identify_platform..Ds *$$r+z'calling %s with %s raised exception: %s) _collect_platform_datarNrQrTrWrYrHrr_r)rGcheckscheckerrrs r,rIrI:s~ ! #D$F T]F    KK97D!   s A A/ A**A/c<i} tjdj}d|d<|d}|j |d<t j d}|d}|j |d <t j d }|d}|j |d <t j d }|r|ndj |d <t j d}|r|ndj |d<|S#t$rt j d}d|d<YwxYw)aReturns a dictionary of platform info from dmi or /sys/hypervisor. Keys in the dictionary are as follows: uuid: system-uuid from dmi or /sys/hypervisor uuid_source: 'hypervisor' (/sys/hypervisor/uuid) or 'dmi' serial: dmi 'system-serial-number' (/sys/.../product_serial) asset_tag: 'dmidecode -s chassis-asset-tag' vendor: dmi 'system-manufacturer' (/sys/.../sys_vendor) product_name: dmi 'system-product-name' (/sys/.../system-manufacturer) On Ec2 instances experimentation is that product_serial is upper case, and product_uuid is lower case. This returns lower case values for both. z/sys/hypervisor/uuidrLrKz system-uuidrrQrJzsystem-serial-numberrMzchassis-asset-tagrSzsystem-manufacturerrVzsystem-product-namerE)r load_text_filestriprr read_dmi_datar)rGrJrMrSrVrEs r,r]r]Qs# D$""#9:@@B*]  |::.sCF$&r+c*|j|fSr9)rj)macrds r,r\z"_build_nic_order..sm//45r+cD|j|d}| t|S|Sr9)rjr)diktkey alt_valuevalues r,_get_key_as_int_orz,_build_nic_order.._get_key_as_int_ors(d#  u: r+c\|ddtd|ddtdfS)Nrgz network-cardinfinity device-number)float)rhrps r,r\z"_build_nic_order..s<&Aj0A'Az1B !r+)rm)rfiltermap enumeratesorted)rdru nic_ordervalid_macs_metadatairj _mac_metadatarps` @r,_build_nic_orderr}s !#I 4yA~]+q0 & 5t< (1 #  (    #A#] Q  sA2 dev_confignic_name nic_metadatar?is_ipv4tablec|r#|jd}|jd}n"|jd}|jd}|r|s tjd|rdydy|jd sg|d <|r; |jj || }|d } |d j d | |d t|tr|gn|}|D]} |d j | |d|jdsg|d<t|tr|gn|}|D]} |dj | |dy#t $r!} tjd|| Yd} ~ d} ~ wwxYw)a Configure policy-based routing on secondary NICs / secondary IPs to ensure outgoing packets are routed via the correct interface. @param: dev_config: network cfg v2 to be updated inplace. @param: nic_name: nic name. Only used if ipv4. @param: nic_metadata: nic metadata from IMDS. @param: distro: Instance of Distro. Only used if ipv4. @param: is_ipv4: Boolean indicating if we are acting over ipv4 or not. @param: table: Routing table id. subnet-ipv4-cidr-block local-ipv4szsubnet-ipv6-cidr-blocksipv6szANot enough IMDS information to configure policy routing for IPv%s46Nroutes)r?routersz 0.0.0.0/0)toviarzoCould not perform dhcp discovery on %s to find its gateway. Not adding default route via the gateway. Error: %s)rrrouting-policy)fromr) rjr_r` dhcp_clientdhcp_discoveryrrrrr') r~rrr?rrsubnet_prefix_routesipsleasegatewayr prefix_routeips r,_configure_policy_routingrs(+//0HI}-+//0IJw' S  C !$  >>( #! 8 &&55hv5NEI&G x ' '%""  *C 0  ! - 8##"    >>* +') #$c3'3%SC #$++   I   KK    s"D<< E&E!!E&c did}|stj}|dd}|sg|jD] \}}||k(s ndddjid} |j |} | j d rd| d <| |d |<|St |j tj} t|j} t|| } | D]}||}|j |} | s| |}|d k(}d |dzdzi}d|dd|ji|d} d|z}| r)| j dr|sd|d<t| ||| d|| j d r0d| d <|| d<| r$| j dr|st| ||| d|t| || d<| ds| jd| |d |<t|d dk(rw|d jD]a}|d |jd|d |jdd|d |jdd|d |jddc|S)a8Convert ec2 metadata to network config version 2 data dict. @param: network_md: 'network' portion of EC2 metadata. generally formed as {"interfaces": {"macs": {}} where 'macs' is a dictionary with mac address as key and contents like: {"device-number": "0", "interface-id": "...", "local-ipv4s": ...} @param: distro: instance of Distro. @param: macs_to_nics: Optional dict of mac addresses and nic names. If not provided, get_interfaces_by_mac is called to get it from the OS. @param: fallback_nic: Optionally provide the primary nic interface name. This nic will be guaranteed to minimally have a dhcp4 configuration. @param: full_network_config: Boolean set True to configure all networking presented by IMDS. This includes rendering secondary IPv4 and IPv6 addresses on all NICs and rendering network config on secondary NICs. If False, only the primary nic will be configured and only with dhcp (IPv4/IPv6). @return A dict of network config version 2 based on the metadata and macs. )version ethernetsrtruTF macaddress)dhcp4dhcp6matchset-namerrrrz route-metricrgd)rdhcp4-overridesrrrrsz use-routes)r?rrrrzdhcp6-overrides addressesrNrr)rget_interfaces_by_macrvrrjrnetwork_rendererrRendererrxkeysr}rget_secondary_addressespopr) network_mdr? macs_to_nicsrrnetcfgrdrjrr~r is_netplanrurynic_idxis_primary_nic dhcp_overriders r,rrs4 ,F 002 |,V4M )//1 MC<' "CIIK0  %((-   G $"&Jw (2{H% F33W5E5EFJ ,##% &D 5I;3$$((-  C. A''A+)<= ,"CIIK0  g    1"*.M, ' %!)     G $"&Jw ,9J( ) $$_5&)!%!-! #:,"L ;+& NN; '(2{H%w;3| 6+ 1${+002 FH ;  ) - -.? @ ;  ) - -.? F ;  ) - -h = ;  ) - -.> E  F Mr+c ||jd}|jd}g}tt|txrt |dkDr|j t |d||dtt|txrt |dkDr|j t |d||dt|S)zParse interface-specific nic metadata and return any secondary IPs :return: List of secondary IPv4 or IPv6 addresses to configure on the interface rrrgr24zsubnet-ipv6-cidr-block128)rjrrrrextend_get_secondary_addressesrx)rrjipv4srrs r,rrs   ] +E   W %EI Jud # 6E Q7 $6UD   Jud # 6E Q7 $6UE  ) r+c4g}|j|}|}|rt|jddk7r#d|vrdnd}tj d|||||n|jdd}|ddD]$} |j dj | | &|S) zReturn list of IP addresses as CIDRs for secondary IPs The CIDR prefix will be default_prefix if cidr_key is absent or not parseable in nic_metadata. rrrNrOzJCould not parse %s %s for mac %s. %s network config prefix defaults to /%srgNz {ip}/{prefix})rprefix)rjrsplitr_rrr) rcidr_keyrjrdefault_prefixrcidrrip_typers r,rrs I   H %D F 3tzz#'1,"h.&F  -      C#!"gG//2f/EFG r+c6tj|tSr9)rlist_from_depends datasources)dependss r,get_datasource_listrs  $ $Wk ::r+)NNT)Erloggingrrtypingrr cloudinitrrrrrr r cloudinit.distrosr cloudinit.eventr r cloudinit.netrcloudinit.net.dhcprcloudinit.net.ephemeralrcloudinit.sources.helpersr getLoggerrr_ frozenset NOT_FOUNDSKIP_METADATA_URL_CODESr]r^rr2r#r"rrF DataSourcer4r2r[r7rrHrNrQrTrWrYrIr]r'rr}rrrrrrDEP_FILESYSTEM DEP_NETWORKrrr*r+r,rs  '')$$1!/6)g!#U__$563 ( ( H %/NNJ4E4E#F  B ?G&&B ?J::.B E! $ ! # #.,^6T ?6*.s)6 #s(^6rR R R  R  R  R  R  R p vr2<'0023W++W-@-@AB ;r+