܍~cddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl m Z ddl m Z ddl mZddlmZmZddlmZmZmZddlmZddlmZdd lmZmZmZmZmZmZm Z dd l!m"Z"dd l#m$Z$ej%e&Z'd Z(d Z)dZ*dZ+dZ,dZ-dZ.e"j/dddZ0dZ1dZ2dZ3e2dZ4e2dZ5ddde6de"j7fdZ8d Z9e2e$d!fd"Z:e2d#Z;e d$Zd+ee6d,e?d-e?dej@f d.ZAd/e6d0e6d1e6deBfd2ZCGd3d4ZDGd5d6eEZFGd7d8ZGGd9d:ZHGd;d<ZIGd=d>ZJe2 dNd?e6d@eee6dAee6fdBZKe2dOd?e6dCee6fdDZLdEZMGdFdGeEZNGdHdIeEZOGdJdKejPZQGdLdMZRdS)PN)contextmanager)datetime)ENOENT)sleeptime)ListOptionalUnion) ElementTree)escape)distrosdmisubp temp_utils url_helperutilversion)events) CFG_BUILTINz 168.63.129.16boot-telemetryz system-info diagnostic compressediz'/run/cloud-init/log_pushed_to_kvp_indexzazure-dsz initialize reporter for azure dsT)name descriptionreporting_enabledzThe VM encountered an error during deployment. Please visit https://aka.ms/linuxprovisioningerror for more information on remediation.cfd}|S)Nctjjjt5|i|cdddS#1swxYwYdS)Nrrparent)rReportEventStack__name__azure_ds_reporter)argskwargsfuncs A/usr/lib/python3/dist-packages/cloudinit/sources/helpers/azure.pyimplz)azure_ds_telemetry_reporter..impl7s  $ $    ) ) 4(((  ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) )s=AA)r%r's` r&azure_ds_telemetry_reporterr)6s#))))) Kc||krdSd d}|d}d||d||d||d|d|dg}||kS) z Azure stores the instance ID with an incorrect byte ordering for the first parts. This corrects the byte order such that it is consistent with that returned by the metadata service. Fcdtj|dD}|d|S)Ncg|]}|Sr(r().0bytes r& z.swap_bytestring..Ls 3 3 3td 3 3 3r*r,)textwrapwrapreversejoin)swidthdds r&swap_bytestringz(is_byte_swapped..swap_bytestringKs> 3 3x}Q22 3 3 3 wwr{{r*-r)r,)splitr6) previous_id current_idr:parts swapped_ids r&is_byte_swappedrDBs j  u   S ! !E OE!H % % OE!H % % OE!H % % !H !H  J * $$r*c ntjstdtd t t t tjz }n"#t$r}td|d}~wwxYw tj gdd\}}d}|rd|vr| dd }|std |t |d z z}nJ#tj $r}td |z|d}~wt$r}td |z|d}~wwxYw tj gdd\}}d}|rd|vr| dd }|std|t |d z z}nJ#tj $r}td|z|d}~wt$r}td|z|d}~wwxYwtjtddt!j|dzdt!j|dzdt!j|dztj}tj||S)z[Report timestamps related to kernel initialization and systemd activation of cloud-initz1distro not using systemd, skipping boot telemetryzCollecting boot telemetryz*Failed to determine kernel start timestampN) systemctlshow-pUserspaceTimestampMonotonicT)capture=r<z8Failed to parse UserspaceTimestampMonotonic from systemdi@Bz-Failed to get UserspaceTimestampMonotonic: %sz B     M        %l 3 3 = = ? ?# E E E  %j 1 1 ; ; = = C C C  %&: ; ; E E G G# M M  #  C  Jsartprintwebhookru) base64 encodebyteszlibcompressdecoderrVCOMPRESSED_EVENT_TYPEjsondumpsrZr[) event_name event_contentcompressed_data event_datarcs r&report_compressed_eventrs(})E)EFFO&&w//J   :#   C   $?$?$? Jr* def_log_filecRt}td t|d5}|dt jt|tz |}td ||z |tj||t j td|tjt"t%|dddn #1swxYwYnB#t&$r5}tdt)|ztjYd}~nd}~wwxYwtd  t-jd gd d \}}td |dS#t&$r6}tdt)|ztjYd}~dSd}~wwxYw)azPush a portion of cloud-init.log file or the whole file to KVP based on the file size. The first time this function is called after VM boot, It will push the last n bytes of the log file such that n < MAX_LOG_TO_KVP_LENGTH If called again on the same boot, it continues from where it left off. In addition to cloud-init.log, dmesg log will also be collected.z"Dumping cloud-init.log file to KVPrbrzMDumping last {0} bytes of cloud-init.log file to KVP starting from index: {1}rozcloud-init.logNz#Exception when dumping log file: %szDumping dmesg log to KVPdmesgFT)rrJz$Exception when dumping dmesg log: %s)%get_last_log_byte_pushed_to_kvp_indexrPrQopenseekosSEEK_ENDmaxtellMAX_LOG_TO_KVP_LENGTHryformatSEEK_SETrreadr write_fileLOG_PUSHED_TO_KVP_INDEX_FILEstr Exceptionreprwarningr) file_name start_indexf seek_indexexr^r_s r&push_log_to_kvprss899KII2333 )T " " Ia FF1bk " " "QVVXX(=={KKJ ###)6!&&((Z*?#L#LI     FF:r{ + + + #$4affhh ? ? ? O8#affhh-- H H H I I I I I I I I I I I I I I I     1DHH <           II())) G9UDAAAQ-----     2T"XX =            sSED E EEEEE F&+FF9+G&& H&0+H!!H&c> ttd5}t|cdddS#1swxYwYn#t$rE}|jt kr+tdt|ztj Yd}~nd}~wt$r5}tdt|ztj Yd}~nEd}~wt$r5}tdt|ztj Yd}~nd}~wwxYwdS)Nrz0Reading LOG_PUSHED_TO_KVP_INDEX_FILE failed: %s.roz2Invalid value in LOG_PUSHED_TO_KVP_INDEX_FILE: %s.z2Failed to get the last log byte pushed to KVP: %s.r) rrintrIOErrorerrnorryrrPrrTr)rr]s r&rrs . 4 4 !qvvxx== ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !  7f   #BT!WWLK         @477 J               @477 J           1sQA!A AA  A A  A D;B D(+C D%+DDc#Ktj}tjtj| dVtj|dS#tj|wxYwN)rgetcwdchdirpath expanduser)newdirprevdirs r&cdr5skikkGHRW   ' '(((  s A""A8c |dd}t|dkrod}|dD]}t|dkrd|z}||z } tjdt |ddd}n|d }tj|S) N\r2r>:r<0z>Lutf-8) replacelenr?structpackrencodesocket inet_ntoa)fallback_lease_valueunescaped_value hex_stringhex_pair packed_bytess r&get_ip_from_lease_valuer?s*224< ( "JJ{4Z-?-?R-H-H")M)MNN &--g66  L ) ))r*)r} retry_sleeptimeout_minutesurlheadersr}rrc |dztz}d}d}|s|dz } tj|||d}n#tj$r^}t d||||j|jfztjt|z|ksd t|vrYd}~nd}~wwxYwt||t d ||fztj|S) zReadurl wrapper for querying wireserver. :param retry_sleep: Time to sleep before retrying. :param timeout_minutes: Retry up to specified number of minutes. :raises UrlError: on error fetching data. <rNr<)rr)rr}timeoutzdFailed HTTP request with Azure endpoint %s during attempt %d with exception: %s (code=%r headers=%r)rozNetwork is unreachablez@Successful HTTP request with Azure endpoint %s after %d attempts) rrreadurlUrlErrorrycoderrPrQrr) rrr}rrrattemptresponser]s r&http_with_retriesrMsD"TVV+GGH1  !)W4H "    #EAFAI67 I     $//+s1vv5565555 & k58 g 'I Os:B' AB""B'usernamehostname disableSshPwdctjd}||||}|dS)Na. 1.0 LinuxProvisioningConfiguration {username} {disableSshPwd} {hostname} 1.0 true )rrrr)r3dedentrr)rrrOVF_ENV_TEMPLATErets r&build_minimal_ovfrsR  2  ! !HM "  C ::g  r*cPeZdZdddZdZd dejfdZ d dejfd ZdS) AzureEndpointHttpClient WALinuxAgentz 2012-11-30)zx-ms-agent-namez x-ms-versioncd|d|_dS)N DES_EDE3_CBC)zx-ms-cipher-namez!x-ms-guest-agent-public-x509-cert)extra_secure_headers)self certificates r&__init__z AzureEndpointHttpClient.__init__s .1<% % !!!r*Frrc|j}|r3|j}||jt ||S)N)r)rcopyupdaterr)rrsecurers r&getzAzureEndpointHttpClient.getsL,  6l''))G NN44 5 5 5 g6666r*Nc|j}|.|j}||t|||S)N)r}r)rrrr)rrr} extra_headersrs r&postzAzureEndpointHttpClient.postsK,  $l''))G NN= ) ) ) 4AAAAr*)FNN) r! __module__ __qualname__rrr UrlResponserrr(r*r&rrs*$G    77 (>7777-1BB  BBBBBBr*rceZdZdZdS)InvalidGoalStateXMLExceptionz9Raised when GoalState XML is invalid or has missing data.N)r!rr__doc__r(r*r&rrsCCCCr*rc @eZdZ d deeefdededdfdZdZ dS) GoalStateT unparsed_xmlazure_endpoint_clientneed_certificaterrNc||_ tj||_n6#tj$r$}t d|zt jd}~wwxYw|d|_ |d|_ |d|_ dD]A}t||/d|z}t |t jt|Bd|_|d }|v|rvtjd d t" 5|j|d j|_|jtd ddddS#1swxYwYdSdSdS)ahParses a GoalState XML string and returns a GoalState object. @param unparsed_xml: string representing a GoalState XML. @param azure_endpoint_client: instance of AzureEndpointHttpClient. @param need_certificate: switch to know if certificates is needed. @return: GoalState object representing the GoalState XML string. z!Failed to parse GoalState XML: %sroNz./Container/ContainerIdz4./Container/RoleInstanceList/RoleInstance/InstanceIdz ./Incarnation) container_id instance_id incarnationzMissing %s in GoalState XMLzD./Container/RoleInstanceList/RoleInstance/Configuration/Certificateszget-certificates-xmlzget certificates xmlrT)rz/Azure endpoint returned empty certificates xml.)rr fromstringroot ParseErrorryrPr_text_from_xpathrrrgetattrrcertificates_xmlrr r"rcontents)rrrrr]attrrqrs r&rzGoalState.__init__s &;" #.|<s/&(F3Ic---  r*cl|d|}gd}tj||\}}|S)Nz-pubkey)z ssh-keygenz-iz-mPKCS8z-fz /dev/stdinr*)r/r)rrpub_key keygen_cmdssh_keyr_s r&_get_ssh_key_from_certz%OpenSSLManager._get_ssh_key_from_certEs?'' ;??LLL Yz888 r*c|d|}|d}||dzdd}d|S)aopenssl x509 formats fingerprints as so: 'SHA1 Fingerprint=07:3E:19:D1:4D:1C:79:92:24:C6:A0:FD:8D:DA: B6:A8:BF:27:D4:73 ' Azure control plane passes that fingerprint as so: '073E19D14D1C799224C6A0FD8DDAB6A8BF27D473' z -fingerprintrKr<rr2)r/r r?r6)rrraw_fpeqoctetss r&_get_fingerprint_from_certz)OpenSSLManager._get_fingerprint_from_certLsZ&&~{CC [[  Q $**3//wwvr*cjtj|d}|j}ddddd|dg}t |j5tjdjd i|j d d | \}}d d d n #1swxYwY|S)zDecrypt the certificates XML document using the our private key; return the list of certs and private keys contained in the doc. z.//DatasMIME-Version: 1.0s<Content-Disposition: attachment; filename="Certificates.p7m"s?Content-Type: application/x-pkcs7-mime; name="Certificates.p7m"s!Content-Transfer-Encoding: base64r*rzuopenssl cms -decrypt -in /dev/stdin -inkey {private_key} -recip {certificate} | openssl pkcs12 -nodes -password pass:T )shellr}Nr() r rr r rrrrrr%r6)rrtagcertificates_contentlinesr^r_s r&_decrypt_certs_from_xmlz&OpenSSLManager._decrypt_certs_from_xmlZs $%566;;IFF"x K N 0  ' ' 0 0   __  Y*##)DD,0,BDDZZ&& FC                s>B((B,/B,cv||}g}i}|D]}||tjd|rg}/tjd|rFd|}||}||}|||<g}|S)zGiven the Certificates XML document, return a dictionary of fingerprints and associated SSH keys derived from the certs.z[-]+END .*?KEY[-]+$z[-]+END .*?CERTIFICATE[-]+$ )rB splitlinesappendrematchr6r5r;) rrr^currentkeysr'rr4 fingerprints r&parse_certificatesz!OpenSSLManager.parse_certificatesss**+;<<NN$$  D NN4 x.55 8$?? "ii00 55kBB"==kJJ $+[! r*N)r!rrr%rrpropertyrsetterr)r staticmethodr/r5r;rBrLr(r*r&rrs3.* $$$ """!!X!"""!00! 0> ! \ !!  !  !  !! 0!! r*rc eZdZejdZejdZdZdZdZ dZ de de d e d d fd Zedd Zede d d fdZ dde de de de d e f dZede d d fdZd S)GoalStateHealthReportera {incarnation} {container_id} {instance_id} {health_status} {health_detail_subsection} z
{health_substatus} {health_description}
ReadyNotReadyProvisioningFailedi goal_staterendpointrrNc0||_||_||_dS)a?Creates instance that will report provisioning status to an endpoint @param goal_state: An instance of class GoalState that contains goal state info such as incarnation, container id, and instance id. These 3 values are needed when reporting the provisioning status to Azure @param azure_endpoint_client: Instance of class AzureEndpointHttpClient @param endpoint: Endpoint (string) where the provisioning status report will be sent to @return: Instance of class GoalStateHealthReporter N) _goal_state_azure_endpoint_client _endpoint)rrUrrVs r&rz GoalStateHealthReporter.__init__s"&&;#!r*cx||jj|jj|jj|j}t d ||n1#t$r$}td|zt j d}~wwxYwt ddS)N)rrrstatusz Reporting ready to Azure fabric.documentz#exception while reporting ready: %srozReported ready to Azure fabric.) build_reportrXrrrPROVISIONING_SUCCESS_STATUSrPrQ_post_health_reportrryerrorrm)rr^r]s r&send_ready_signalz)GoalStateHealthReporter.send_ready_signals$$(4)6(43 %   4555   $ $h $ 7 7 7 7    #59I        233333sA// B9BBrcV||jj|jj|jj|j|j|} ||n3#t$r&}d|z}t|tj d}~wwxYwt ddS)N)rrrr\ substatusrr]z%exception while reporting failure: %sroz!Reported failure to Azure fabric.) r_rXrrrPROVISIONING_NOT_READY_STATUSPROVISIONING_FAILURE_SUBSTATUSrarryrPrbr)rrr^r]rqs r&send_failure_signalz+GoalStateHealthReporter.send_failure_signals$$(4)6(459# %     $ $h $ 7 7 7 7   9A=C #CSY ? ? ? ?   788888sA B &!BB rrrr\cTd}|C|jt|t|d|j}|jtt |t|t|t||}|S)Nr2)health_substatushealth_description)rrr health_statushealth_detail_subsection)%HEALTH_DETAIL_SUBSECTION_XML_TEMPLATErr "HEALTH_REPORT_DESCRIPTION_TRIM_LENHEALTH_REPORT_XML_TEMPLATEr) rrrrr\rer health_detail health_reports r&r_z$GoalStateHealthReporter.build_reports   FMM!' !2!2#) I$"I IJ$$NM7>>s;//00 --{++ ..%2 ?  r*r^cttdtdd|j}|j||dditddS)Nrz&Sending health report to Azure fabric.zhttp://{}/machine?comp=healthz Content-Typeztext/xml; charset=utf-8)r}rz/Successfully sent health report to Azure fabric)rrrPrQrrZrYr)rr^rs r&raz+GoalStateHealthReporter._post_health_reports( a :;;;-44T^DD #(( )+DE )   CDDDDDr*rrNr)r!rrr3rrprnr`rfrgrorrrrr)rcrhr_rar(r*r&rQrQst!0 "",-I           s04 A'A""A'cd}|j!|t|_|jj}|jt ||_||du}d}||||}t||j|j}|| || |S)aGets the VM's GoalState from Azure, uses the GoalState information to report ready/send the ready signal/provisioning complete signal to Azure, and then uses pubkey_info to filter and obtain the user's pubkeys from the GoalState. @param pubkey_info: List of pubkey values and fingerprints which are used to filter and obtain the user's pubkey values from the GoalState. @return: The list of user's authorized pubkey values. Nr) rxrrrr_fetch_goal_state_from_azure_get_user_pubkeysrQrVr}rc)r pubkey_infor|http_client_certificaterUssh_keyshealth_reporters r&"register_with_azure_and_fetch_dataz3WALinuxAgentShim.register_with_azure_and_fetch_data>s#'   'K,C#1#3#3D &*&:&F #  % -)@'**D &664D@7    "--j+FFH1 2DM     NN7 # # #))+++r*rc|jtd|_|d}t||j|j}||dS)zGets the VM's GoalState from Azure, uses the GoalState information to report failure/send provisioning failure signal to Azure. @param: user visible error description of provisioning failure. NFrr)rrrrQrVrh)rrrUrs r&®ister_with_azure_and_report_failurez7WALinuxAgentShim.register_with_azure_and_report_failuredsm  % -)@)F)FD &666NN 1 2DM   ++ +DDDDDr*rcV|}|||S)aFetches the GoalState XML from the Azure endpoint, parses the XML, and returns a GoalState object. @param need_certificate: switch to know if certificates is needed. @return: GoalState object representing the GoalState XML )"_get_raw_goal_state_xml_from_azure_parse_raw_goal_state_xml)rrunparsed_goal_state_xmls r&rz-WALinuxAgentShim._fetch_goal_state_from_azuress4#'"I"I"K"K-- #%5   r*ctdd|j} t jddt 5|j|}dddn #1swxYwYn1#t$r$}td|ztj d}~wwxYwt d |j S) zFetches the GoalState XML from the Azure endpoint and returns the XML as a string. @return: GoalState XML string zRegistering with Azure...z!http://{}/machine/?comp=goalstatezgoalstate-retrievalzretrieve goalstaterNz9failed to register with Azure and fetch GoalState XML: %sroz#Successfully fetched GoalState XML.)rPrmrrVrr r"rrrryrrQr)rrrr]s r&rz3WALinuxAgentShim._get_raw_goal_state_xml_from_azures+ ,---188GG (*0( ? ?  599#>>  ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?     #KK        7888  s;BA9- B9A==BA=B B3B..B3rc. t||j|}n1#t$r$}td|ztjd}~wwxYwdd|jzd|jzd|j zg}t|tj |S)aParses a GoalState XML string and returns a GoalState object. @param unparsed_goal_state_xml: GoalState XML string @param need_certificate: switch to know if certificates is needed. @return: GoalState object representing the GoalState XML z"Error processing GoalState XML: %sroNz, zGoalState XML container id: %szGoalState XML instance id: %szGoalState XML incarnation: %s) rrrryrPrr6rrrrQ)rrrrUr]rqs r&rz*WALinuxAgentShim._parse_raw_goal_state_xmls "'* JJ     #4q8K        ii0:3JJ/*2HH/*2HH    ;;;;s AAArUrcg}|jX|V|jOtd|j|j}|||}|S)aGets and filters the VM admin user's authorized pubkeys. The admin user in this case is the username specified as "admin" when deploying VMs on Azure. See https://docs.microsoft.com/en-us/cli/azure/vm#az-vm-create. cloud-init expects a straightforward array of keys to be dropped into the admin user's authorized_keys file. Azure control plane exposes multiple public keys to the VM via wireserver. Select just the admin user's key(s) and return them, ignoring any other certs. @param goal_state: GoalState object. The GoalState object contains a certificate XML, which contains both the VM user's authorized pubkeys and other non-user pubkeys, which are used for MSI and protected extension handling. @param pubkey_info: List of VM user pubkey dicts that were previously obtained from provisioning data. Each pubkey dict in this list can either have the format pubkey['value'] or pubkey['fingerprint']. Each pubkey['fingerprint'] in the list is used to filter and obtain the actual pubkey value from the GoalState certificates XML. Each pubkey['value'] requires no further processing and is immediately added to the return list. @return: A list of the VM user's authorized pubkey values. Nz/Certificate XML found; parsing out public keys.)rrxrPrQrL_filter_pubkeys)rrUrrkeys_by_fingerprints r&rz"WALinuxAgentShim._get_user_pubkeyssp:  ' 3'$0 IIG H H H"&"6"I"I+## ++,?MMHr*rc:g}|D]}d|vr$|dr||d*d|vrL|drD|d}||vr|||^td|ztd||S)a8Filter and return only the user's actual pubkeys. @param keys_by_fingerprint: pubkey fingerprint -> pubkey value dict that was obtained from GoalState Certificates XML. May contain non-user pubkeys. @param pubkey_info: List of VM user pubkeys. Pubkey values are added to the return list without further processing. Pubkey fingerprints are used to filter and obtain the actual pubkey values from keys_by_fingerprint. @return: A list of the VM user's authorized pubkey values. rrKzIovf-env.xml specified PublicKey fingerprint %s not found in goalstate XMLzFovf-env.xml specified PublicKey with neither value nor fingerprint: %s)rFrPr)rrrJpubkeyrKs r&rz WALinuxAgentShim._filter_pubkeyss!  F&  VG_  F7O,,,,&((VM-B($]3 "555KK 3K @AAAAKK8#  0  r*rtr)r!rrrrrr)r}r rrrrrrrrr rlistrrOdictrr(r*r&rvrv)sMMMMM ,,,!! !(,## $s) ###! #J! E# E$ E E E!  E!  $      !   !!E!!!! !4!!&sEz!2  ! B!'#'26' '''! 'R!T!!!!!\!!!r*rvrVrr|ct|} ||||S#|wxYw)NrV)rr|)rvrr)rVrr|shims r&get_metadata_from_fabricrsY X . . .D66#W7    s =Arct|}|st} |||dS#|wxYw)Nrr)rv+DEFAULT_REPORT_FAILURE_USER_VISIBLE_MESSAGErr)rVrrs r&report_failure_to_fabricrs_ X . . .D BA  33 3LLL  s AAc~td|ztjtd|ztjdS)Nzdhclient output stream: %srozdhclient error stream: %s)ryrPrQ)r^errs r& dhcp_log_cbr(sT$s* #c)syr*ceZdZdS)BrokenAzureDataSourceNr!rrr(r*r&rr1Dr*rceZdZdS)NonAzureDataSourceNrr(r*r&rr5rr*rc:eZdZdZededfdZdS)ChassisAssetTagz 7783-7084-3265-9085-8269-3286-77rrctjd} ||}n/#t$r"td|ztjYdSwxYwtd|d|jdtj|S)zCheck platform environment to report if this datasource may run. :returns: ChassisAssetTag if matching tag found, else None. zchassis-asset-tagzNon-Azure chassis asset tag: %rroNzAzure chassis asset tag: z ())r read_dmi_datarTryrPrQr)cls asset_tagr?s r& query_systemzChassisAssetTag.query_system<s %&9::  #i..CC    #1I=I    44   2;))SXXX F      s "(A AN)r!rr AZURE_CLOUD classmethodr rr(r*r&rr9sD4KX&78[r*rc.eZdZdddZddddddddddeedeed eed eed eed eee d edeeddfdZ defdZ e deddfdZ ddededefdZ d dedededefdZdZdZdZdS)! OvfEnvXmlz)http://schemas.dmtf.org/ovf/environment/1z)http://schemas.microsoft.com/windowsazure)ovfwaNFrpasswordr custom_datadisable_ssh_password_auth public_keyspreprovisioned_vmpreprovisioned_vm_typerrrrrrrrrrcz||_||_||_||_||_|pg|_||_||_dSrr) rrrrrrrrrs r&rzOvfEnvXml.__init__YsL!     &)B&'2'8b!2&<###r*c"|j|jkSr)__dict__)rothers r&__eq__zOvfEnvXml.__eq__ns}..r* ovf_env_xmlcN tj|}n,#tj$r}d|z}t||d}~wwxYw|d|jst dt}||| ||S)zParser for ovf-env.xml data. :raises NonAzureDataSource: if XML is not in Azure's format. :raises BrokenAzureDataSource: if XML is unparseable or invalid. zInvalid ovf-env.xml: %sNz./wa:ProvisioningSectionz=Ignoring non-Azure ovf-env.xml: ProvisioningSection not found) r rrrr  NAMESPACESrr&_parse_linux_configuration_set_section _parse_platform_settings_section)rrrr] error_strinstances r& parse_textzOvfEnvXml.parse_textqs :)+66DD% : : :1A5I' 22 9 : yy3S^DD $O ;;77===11$777sA;Arrrequired namespacecP|d|d|tj}t|dkr2d|z}t||rt |dSt|dkr!t d|t|fz|dS)Nz./rr#No ovf-env.xml configuration for %rr<:Multiple configuration matches in ovf-exml.xml for %r (%d))findallrrrrPrQr)rnoderrrmatchesrqs r&_findzOvfEnvXml._finds,,,"DD )9+?   w<<1  7$>C IIcNNN 1+C0004 \\A  'LW&'  qzr* decode_base64 parse_boolc|d|ztj}t|dkr2d|z}t||rt ||St|dkr!t d|t|fz|dj} | |} |r;| 9tj d | } |rtj | } | S)Nz./wa:rrr<rr2)rrrrrPrQrr r b64decoder6r?rtranslate_bool) rrrrrrdefaultrrqrs r&_parse_propertyzOvfEnvXml._parse_propertys,,w~y/CDD w<<1  7$>C IIcNNN 1+C000N \\A  'LW&'    =E  =U.$RWWU[[]]%;%;<* * &  +++++r*c||dd}||dd}||dddd|_||dd|_dS) NPlatformSettingsSectionTrPlatformSettingsPreprovisionedVmF)rrrPreprovisionedVMType)rrrr)rrplatform_settings_sectionplatform_settingss r&rz*OvfEnvXml._parse_platform_settings_sections$(JJ +d%/% % !!JJ %'9D'  "&!5!5   "6" " '+&:&:  "';' ' ###r*cg|_||dd}|dS||dd}|dS|dtjD]k}||dd}||dd}||dd d }|||d }|j|ldS) NSSHFr PublicKeysz./wa:PublicKey FingerprintPathValuer2)rr)rKrr)rrrrrrrF) rr ssh_sectionpublic_keys_section public_keyrKrrr4s r&rzOvfEnvXml._parse_ssh_sectionsjjUUjCC   F"jj )    & F-55 i2   - -J..ME/K'' FU'KKD((GR%)E +G   # #G , , , , - -r*)r)FFN)r!rrrr rrrrrrrrrrrrrrr(r*r&rrSs:9J#'"&"&'+48,0"'04===3-=3- = 3- = e_ =$,D>=d4j)= =!) = ====*/t////S[[:    :$ """ "  "  """"H , , ,D   *-----r*rrr)SrenumrloggingrrGrrr3r contextlibrrrrrrtypingrr r xml.etreer xml.sax.saxutilsr cloudinitr rrrrrrcloudinit.reportingrcloudinit.settingsr getLoggerr!rPDEFAULT_WIRESERVER_ENDPOINTrWrkrxrrrr r"rr)rDrdrnrrVryrrrrrrrrrrrrrrrrrQrvrrrrrEnumrrr(r*r&rs   %%%%%%((((((((((!!!!!!######OOOOOOOOOOOOOOOOOO&&&&&&******g!!."%$$  I+F+ 2+,   %%%8PPPf6"  $*).9% % % % P   . * * *  333 33 3- 3  3  33333l 14 DBBBBBBBB<DDDDD9DDD<<<<<<<<~~~~~~~~~B^E^E^E^E^E^E^E^EBbbbbbbbbJ(,!   $s)$ c]    s#     I           di4F-F-F-F-F-F-F-F-F-F-r*