jbc@s{ddlZddlZddlZddlmZddlZddlZddlZddlZddl m Z ddl m Z ddl j jZddlmZddlmZddlmZddlmZdd lmZdd lmZdd lmZmZmZdd lmZdd l m!Z!ddl"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*ej+e,Z-dZ.idd6Z/dddgZ0dZ1dddgZ2dddgZ3dZ4dZ5dZ6dZ7dZ8dZ9d Z:d!Z;d"Z<d#Z=d$Z>d%d&d'd(gZ?d)Z@d*ZAd+ZBeCd,ZDd-ZEd.ZFd/ZGd0ZHejIrd1Z5d2Z6d3Z7eHd4ZJeJeCk re-jKd5d6eJZ4n e-jKd7eCZ>nie1d86e;d96eLd:6ie5d;6eLd<6d=d>6d?d@6dA6ie4dB6dC6e6dD6eLdE6ZMiiidFdG6dHgdI6eLdJ6dB6dK6ie7dL6dMdN6gdO6ZNdPe.gZOdQZPdRZQdSZRd?dTZSd?dUZTe$ejUd?dVZVdWejWfdXYZXdYdZZYe$d[ZZe$d\Z[e$e4d]e\e\d^Z]e$d_Z^e$eCd`Z_e$daZ`e$eCdbZae$dcZbddZce$deZde$dfZee$dgZfdhdiZge$djZhe$e>dkZie$dlZje$dmZkdnZle$doZme$dpZne$eCdqZodrZpdseqfdtYZrdueqfdvYZseXZteXejuffgZvdwZwdS(xiN(tpartial(ttime(tminidom(tlog(tnet(t EventType(tEphemeralDHCPv4(tsources(tnetlink(tUrlErrortreadurltretry_on_url_exc(tutil(tevents(tazure_ds_reportertazure_ds_telemetry_reportertget_metadata_from_fabrictget_boot_telemetrytget_system_infotreport_diagnostic_eventtEphemeralDHCPv4WithReportingtis_byte_swappedtAzuresiid-AZURE-NODEs instance-idtservicet walinuxagenttstartt __builtin__tshs-xcs>i=$interface; x=0; ifdown $i || x=$?; ifup $i || x=$?; exit $xsLi=$interface; x=0; ifconfig down $i || x=$?; ifconfig up $i || x=$?; exit $xs/dev/disk/cloud/azure_resourceteth0s"/var/lib/dhcp/dhclient.eth0.leasestext4s 7783-7084-3265-9085-8269-3286-77s/var/lib/cloud/data/poll_imdss"/var/lib/cloud/data/reported_readys/var/lib/waagentis http://169.254.169.254/metadata/s/sys/firmware/acpi/tables/OEM0s"/etc/netplan/90-hotplug-azure.yamls /usr/local/sbin/ephemeral_eth.shs+/etc/udev/rules.d/10-net-device-added.ruless#/run/network/interfaces.ephemeral.dcCsx|jD]}tjd|r |j}t|dkr|djd}t|dkr|ddkr|dj|r|djd}|dSqq q Wd S( s dev.storvsc.1.%pnpinfo: classid=32412632-86cb-44a2-9b5c-50d1417354f5 deviceid=00000000-0001-8899-0000-000000000000 tpnpinfoiit=itdeviceidit.N(t splitlinestretsearchtsplittlent startswithtNone(t sysctl_outR tlinetfieldstcolumnstcomps((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pyt"find_storvscid_from_sysctl_pnpinfoTs cCsAx:|jD],}tj||r |j}|dSq WdS(s scbus0 on ata0 bus 0 scbus1 on ata1 bus 0 scbus2 on blkvsc0 bus 0 scbus3 on blkvsc1 bus 0 scbus4 on storvsc2 bus 0 scbus5 on storvsc3 bus 0 scbus-1 on xpt0 bus 0 iN(R"R#R$R%R((tcamcontrol_outtdisk_drvR*titems((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pytfind_busdev_from_diskhs   cCslxe|jD]W}tj||r |jd}t|dkrd|djd}|dSq q WdS(s at scbus1 target 0 lun 0 (cd0,pass0) at scbus2 target 0 lun 0 (da0,pass1) at scbus3 target 1 lun 0 (da1,pass2) t(iit,iN(R"R#R$R%R&R((R/tbusdevR*R1tdev_pass((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pytfind_dev_from_busdev{scCsJytj|dSWn.tjk rEtjddj||SXdS(NisFailed to execute: %st (R tsubptProcessExecutionErrortLOGtdebugtjoin(tcmdtfail_ret((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pytexecute_or_debugs cCstddgddS(Ntsysctls dev.storvscR?t(R@(((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pytget_dev_storvsc_sysctlscCstdddgS(Nt camcontroltdevlists-b(R@(((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pytget_camcontrol_dev_busscCstddgS(NRDRE(R@(((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pytget_camcontrol_devsc Cs4d}|dkr%d}|d}ndt|}dj||}t}t||}|svtjddSt}t}dj|}t ||} | rt || } | dkrtjd dS| Sd j|} t || } | r0t || } | dkr,tjd dS| SdS( Nt00000000it00000001it000s{0}-{1}s#Fail to find storvsc id from sysctls blkvsc{0}sFail to find /dev/daXs storvsc{0}( tstrtformatRCR.R;R<R(RFRGR2R7( tport_idtg0tg1tg0g1R)t storvscidtcamcontrol_b_outR/tblkvsctscbusxtdevnametstorvsc((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pytget_resource_disk_on_freebsds<          thn0s/var/db/dhclient.leases.hn0s freebsd-ufsisresource disk is not Nones/dev/sresource disk is Nonet agent_commandtdata_dirt set_hostnamet interfacetpolicytbuiltintcommandthostnamethostname_commandthostname_bouncet ephemeral0t disk_aliasestdhclient_lease_filetapply_network_configtgptt table_typeidtlayoutt overwritet disk_setupt filesystems ephemeral0.1tdevicetfs_setupt datasourcetnever_destroy_ntfssTemporary StoragetREDACTEDcCs>t|ttfs!|f}ntj|dtdjS(Ntcapturei(t isinstancetlistttupleR R9tTruetstrip(Ra((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pyt get_hostnames cCs tjddt|gdS(Nt hostnamectls set-hostname(R R9RK(R`Ra((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pyR[sc cs|dd}t|}tj|jd sZtj|sZ||krc|dkrcdVdSt||z |VWdt||XdS(s Set a temporary hostname, restoring the previous hostname on exit. Will have the value of the previous hostname when used as a context manager, or None if the hostname was not changed. RbR]R[tforceN(RxR tis_truetgettis_falseR(R[(t temp_hostnametcfgRaR]tprevious_hostname((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pyttemporary_hostnames    tDataSourceAzurecBs4eZdZeZejZdZdZ e dZ e dZ dZ e dZdZddZe d Zd Zd Zd Zdd Ze dZdZe dZdZdZe dZe dZedZedZ edZ!RS(RcCstjj||||tjj|jd|_i|_d|_ t j t j |t itg|_|jjd|_d|_|jdjtjd|_dS(NtazureRetnetwork(Rt DataSourcet__init__tostpathR=tseed_dirRR(tseedR t mergemanydicttget_cfg_by_patht DS_CFG_PATHtBUILTIN_DS_CONFIGtds_cfgR|Ret_network_configt update_eventstaddRtBOOTt_ephemeral_dhcp_ctx(tselftsys_cfgtdistrotpaths((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pyR#s   cCs#tjj|}d||jfS(Ns %s [seed=%s](RRt__str__R(Rtroot((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pyR1sc Cs|jjd}tjd||jdd}t||jd|}|dk rtj|jjdr|jd}yt d|d|d|SWqt k r}tj d |tj td qXnWdQXt S( Nslocal-hostnamesHostname in metadata is %sRbRaR[R`Rt prev_hostnamesFailed publishing hostname: %sshandling set_hostname failed(tmetadataR|R;R<RRR(R R{tperform_hostname_bouncet ExceptiontwarningtlogexctFalse(Rtazure_hostnameRat previous_hnRte((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pyt"bounce_network_with_azure_hostname5s"     c Cs|jjd}|jd}tjd|||jyt|Wn.tjk rztj td|jdnX|jd}g}d}x|j jdgD]o}|jddr|d}tjdqt |d d }|t jj||g7}tjd qWtjd d dddtTtjdtjdddtjd|df}t|rtjd|nWdQXi} |pt|| d<| S(Nslocal-hostnameRYs/Getting metadata via agent. hostname=%s cmd=%ssagent command '%s' failed.RZt_pubkeystvalues+ssh authentication: using value from fabrict fingerprints.crts1ssh authentication: using fingerprint from fabrictnameswaiting-for-ssh-public-keyt descriptions$wait for agents to retrieve ssh keystparenttlogfunctmsgs waiting for SSH public key filestfunctargsis$Did not find files, but going on: %ss public-keys(RR|RR;R<Rt invoke_agentR R:RR(RRKRRR=R tReportEventStackRtlog_timetwait_for_filesR&Rtpubkeys_from_crt_files( RR~t agent_cmdtddirtfp_filest key_valuetpktbnametmissingR((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pytget_metadata_from_agentOsB           cCs2|jjdrd}nd}d||jfS(s/Return the subplatform metadata source details.s/devs config-disksseed-dirs%s (%s)(RR'(Rtsubplatform_type((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pyt_get_subplatform~s c Csi}|jd}|jg}tjjtrD|jddn|jt|rj|j |nd}t }x|D]}yv|dkrd}t }nW|j drtjrtj|tdd}qtj|t}n t|}Wntk rtd|q}nmtk rR}d|} t| tj| n8tjk rd |} t| tj| q}nX|p|j|} | rtjrd } tj| t| tj| n|j}nt|jd d } |\} } }}||_|j i|d 6|d6tj!| i| d6gd6| d6|}tj"d|Pq}W|sd} t| tj| n||krtj"d|nt#}|r||dd      cCs|jdj|S(NRd(RR|(RR((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pytdevice_name_to_device'scCs|jS(N(R(R((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pytget_config_obj*scCstj|jS(N(Rtinstance_id_matches_system_uuidtget_instance_id(RR((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pytcheck_instance_id-scCsqtjj|jjdd}tjd}tjj|rmtj|j }t ||rm|Sn|S(Ntdatas instance-ids system-uuid( RRR=Rt get_cpathR t read_dmi_datatexistst load_fileRwR(Rtprevioust prev_iid_pathtiid((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pyR1s cCs|jtkritjd|j||j}tjd||r]|jj|nt|_ntjd|jdS(Ns$negotiating for %s (new_instance=%s)snegotiating returned %ssnegotiating already done for %s( t _negotiatedRR;R<Rt _negotiateRRRv(Rtis_new_instancet fabric_data((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pytsetup;s    c std}idd6}d }ttjjt }d_d_d}t }d }fd}t j dxt rzyt jdd d d d t t_jj} Wd QX|r|d7}n|rytj}Wn;tjk r+} t| t j| jjPnXt} t jd| tj| djdtjdtjd| t }t jddd dd tKytj || dWn+t!k r} t| t j"| PnXWd QXt }jjnSt jddd dd t2t#|dt$d|d|dt dt j%}Wd QXPWnt&k rxjjnXWd |r|j'nXqyW|rtd|tdjn|S(stPoll IMDS for the new provisioning data until we get a valid response. Then return the returned JSON object.s&reprovisiondata?api-version=2017-04-02ttruetMetadataiicst|tr|jdkrjjkrqjd9_tjd||jjtjdjnjd7_tStjd||jtd|jt S(NiisJCall to IMDS with arguments %s failed with status code %s after %s retriess:Backing off logging threshold for the same exception to %dis:Call to IMDS with arguments %s failed with status code %ss%polling IMDS failed with exception %s( RsR tcodetimds_poll_countertimds_logging_thresholdR;R<RvRR(Rt exception(R(sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pytexc_cbVs      sWait for vnetswitch to happenRsobtain-dhcp-leaseRsobtain dhcp leaseRNs*Creating a marker file to report ready: %ss{pid}: {time} tpidRRs!wait-for-media-disconnect-connectswait for vnet switchR\sget-reprovision-data-from-imdssget reprovision data from imdsttimeouttheaderst exception_cbtinfinitet log_req_resps#attempted dhcp %d times after reuses polled imds %d times after reuse((tIMDS_URLR(tboolRRRtREPORTED_READY_MARKER_FILERRRR;R<RvR RRRRt obtain_leaseRtcreate_bound_netlink_sockettNetlinkCreateSocketErrorRRRRR t write_fileRLtgetpidRRt!wait_for_media_disconnect_connecttAssertionErrorRR tIMDS_TIMEOUT_IN_SECONDStcontentsR tclose( RturlRtnl_sockt report_readyt dhcp_attemptst vnet_switchedt return_valRRRRR((RsE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pyt _poll_imdsIs                        cCs@ytd|dWn$tk r;tjddtnXdS(s,Tells the fabric provisioning has completed s unknown-245sNError communicating with Azure fabric; You may experience.connectivity issues.texc_infoN(RR(RR;RRv(RR((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pyRs  cCs|s tS|\}}}}t}|jdtksItjj|rtjj|stjd|t j |dj dtj dt ntStS(sWhether or not we should poll IMDS for reprovisioning data. Also sets a marker file to poll IMDS. The marker file is used for the following scenario: the VM boots into this polling loop, which we expect to be proceeding infinitely until the VM is picked. If for whatever reason the platform moves us to a new host (for instance a hardware issue), we need to keep polling. However, since the VM reports ready to the Fabric, we will not attach the ISO, thus cloud-init needs to have a way of knowing that it should jump back into the polling loop in order to retrieve the ovf_env.tPreprovisionedVms'Creating a marker file to poll imds: %ss{pid}: {time} RR(RRR|RvRRRR;RR R!RLR"R(RRt_mdt _userdata_rawRt_filesR((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pyRs  c Csa|j}tjdddddt1t|\}}}|||i|d6fSWdQXdS(s%Initiate the reprovisioning workflow.Rsreprovisioning-read-azure-ovfRs$read azure ovf during reprovisioningRs ovf-env.xmlN(R.R RRtread_azure_ovf(RR&RtudR((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pyRs   cCs|jdtkrP|j|jjdd }ttd|jd|}n |j }t j d|jdy |}Wn5t k r}t d|t jddttSXtjttjt|S( sNegotiate with fabric and return data from it. On success, returns a dictionary including 'public_keys'. On failure, returns False. RYRtfallback_lease_filet pubkey_infos,negotiating with fabric via agent command %ssQError communicating with Azure fabric; You may experience connectivity issues: %ssNError communicating with Azure fabric; You may experience connectivity issues.R/N(RtAGENT_START_BUILTINRRR|R(RRReRR;R<RRRRvRR tdel_fileRR(RR7t metadata_funcR R((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pyR s,         cCs&td|d|jjttdS(NR t preserve_ntfs(taddress_ephemeral_resizeRR|tDS_CFG_KEY_PRESERVE_NTFSR(RRR ((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pytactivates   cCs(|jjdijdijdS(NRtcomputetplatformFaultDomain(RR|(R((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pytavailability_zone s cCsY|j s|jtjkrR|jjdr:|j}nd}t||_n|jS(sGenerate a network config like net.generate_fallback_network() with the following exceptions. 1. Probe the drivers of the net-devices present and inject them in the network configuration under params: driver: value 2. Generate a fallback network config that does not include any of the blacklisted devices. RfN(RRRRR|RR(tparse_network_config(Rtnc_src((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pytnetwork_configs  cCs(|jjdijdijdS(NRR?tlocation(RR|(R((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pytregion"s(N("t__name__t __module__tdsnameRR RRRRRRRRRRRRRRRRR(RR R.RRRR R>tpropertyRARDRF(((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pyRs4   / i  /     j  $icCsxdD]x}g}x_td|D]N}||t|}tjj|r#|j|tjj|fq#q#W|r|SqWgS(Ns-parttpRBi(s-partRKRB(trangeRKRRRRtrealpath(tdevpathtmaxnumtsuffRtpnumtppath((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pyt_partitions_on_device's &cCs;tjddt}tjd|tjj||kS(Ns TYPE=ntfstno_cachesntfs_devices found = %s(R tfind_devs_withRvR;R<RRRM(RNt ntfs_devices((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pyt_has_ntfs_filesystem4sc Cs\|r)ddjttf}t|fStjj|sItd|fStjd|tjj |t |}t |dkrtd|fSt |dkrd|d jg|D]}|d ^qf}t|fSt |dkr|d \}}n|d\}}t |s>d |||f}t|fSt d }d |||f}tjdddddt} y)tj||dddidd6} WnTtjk r} d| _dt| krt|dfSt|d|| ffSX| dkrHd| | _tjddjttt|d| fSWdQXt|dfS( sDetermine if the ephemeral drive at devpath should be reformatted. A fresh ephemeral disk is formatted by Azure and will: a.) have a partition table (dos or gpt) b.) have 1 partition that is ntfs formatted, or have 2 partitions with the second partition ntfs formatted. (larger instances with >2TB ephemeral disk have gpt, and will have a microsoft reserved partition as part 1. LP: #1686514) c.) the ntfs partition will have no files other than possibly 'dataloss_warning_readme.txt' User can indicate that NTFS should never be destroyed by setting DS_CFG_KEY_PRESERVE_NTFS in dscfg. If data is found on NTFS, user is warned to set DS_CFG_KEY_PRESERVE_NTFS to make sure cloud-init does not accidentally wipe their data. If cloud-init cannot mount the disk to check for data, destruction will be allowed, unless the dscfg key is set.s:config says to never destroy NTFS (%s.%s), skipping checksR!sdevice %s does not existsResolving realpath of %s -> %sisdevice %s was not partitionedis&device %s had 3 or more partitions: %sR8is5partition %s (%s) on device %s was not ntfs formattedcSsGtdg}tgtj|D]}|j|kr"|^q"S(Nsdataloss_warning_readme.txt(tsetR&Rtlistdirtlower(tmptignoredtf((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pyt count_fileslss1partition %s (%s) on device %s was ntfs formattedRsmount-ntfs-and-countRRRtntfstupdate_env_for_mounttCtLANGscannot mount ntfssunknown filesystem type 'ntfs's^ but this system cannot mount NTFS, assuming there are no important files. Formatting allowed.s but mount of %s failed: %ssmounted and counted %d filessxit looks like you're using NTFS on the ephemeral disk, to ensure that filesystem does not get wiped, set %s.%s in configs but had %d files on it.Ns3 and had no important files. Safe for reformatting.(R=RR=RRRRR;R<RMRSR&RWRR RRR RRRRKRvR( RNR;Rt partitionsRKt cand_partt cand_pathR^tbmsgtevtt file_countR((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pytcan_dev_be_reformatted;sX   -          ixc Csdd}tjdddddtFtj|gd|d|d d }|rftjd ||dSWdQXt}d}|rt d }}nt ||\}}tj d |||sdSxddgD]}d|} d| |f} t j j| rLy!t j| tj d| Wq\tk rH} tjd| | q\Xqtj d| qWdS(Ng?Rswait-for-ephemeral-diskRswait for ephemeral diskRtmaxwaittnaplentlog_presAzure ephemeral disk: s6ephemeral device '%s' did not appear after %d seconds.sFirst instance boot.sreformattable=%s: %sRktmountss#/var/lib/cloud/instance/sem/config_sMarker "%s" for module "%s"s %s removed.s%s: remove failed! (%s)s%s did not exist.(R RRR RR;RRR(RvRiR<RRRtunlinkR( RNRjR R;RkRtresultRtmodtsempathRfR((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pyR<s@        c Cs|d}|d}|d}d|||f}tjj}||d<||d<||d<|dkrtjrt}qtjdrt}qtj d t Sntj d |t |t t f }tjd tj d d dtdtjdi|d6|d6t d6|d6tS(NR_R\R]s"hostname=%s policy=%s interface=%sR`t old_hostnameR^tifups7Skipping network bounce: ifupdown utils aren't present.s"pubhname: publishing hostname [%s]RRspublishing hostnamet get_uptimeRtkwargsRtshellRrtenv(RtenvirontcopyR RtBOUNCE_COMMAND_FREEBSDtwhichtBOUNCE_COMMAND_IFUPR;R<RRsRtRuRRvR9( R`RRR_R\R]RRwRv((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pyRs0           cCs=d}tjdd||gdtd|\}}|jS(NsHopenssl x509 -noout -pubkey < "$0" |ssh-keygen -i -m PKCS8 -f /dev/stdinRs-cRrR(R R9Rvtrstrip(tfnameRtpipelinetoutt_err((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pytcrtfile_to_pubkeyscCsug}g}xI|D]A}y|jt|Wqtjk rS|j|qXqW|rqtjd|n|S(Ns-failed to convert the crt files to pubkey: %s(RRR R:R;R(tflisttpubkeysterrorsR~((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pyRs cCsd}|sdS|s"i}ntj||xi|jD][\}}tjj||}d|kr~|||}ntjd|d|ddq?WdS(NcSsyatj|}x>|jD]0}d|jkr|jtkrt|_qqWtj|SWn"tk rtj d||SXdS(s>Azure provides the UserPassword in plain text. So we redact itt UserPasswords#failed to redact userpassword in %sN( tETt fromstringtiterttagttexttDEF_PASSWD_REDACTIONttostringRR;tcritical(tcntR~Rtelem((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pyt_redact_passwords s ovf-env.xmltfilenametcontenttmodei(R t ensure_dirR1RRR=R!(tdatadirRRRRRR~((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pyRs   cCsG|r6tjd|tj|dt|t n tjddS(Nsinvoking agent: %sRvsnot invoking agent(R;R<R R9RsRt(R>((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pyRs cCsJg}|js|Sx-|jD]"}||r |j|q q W|S(N(t hasChildNodest childNodesR(tnodet filter_funcRtchild((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pyt find_childs  c Cst|d}t|dkr(gSt|dkrStdt|n|d}t|d}t|dkrgSg}tjj}x|D]}|jsqnidd6dd6dd 6}x|jD]}|j|ks|j rqn|j j } | |j kr'qnt|jdks|jdj|krXqn|jdj j || 6siis%Multiple 'PublicKeys'(%s) in SSH nodecSs |jdkS(Nt PublicKey(R(R((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pyR>sRBRRR(RR&RRtDocumentt TEXT_NODERRtnodeTypeRRZtkeyst wholeTextRwR( tsshnodetresultst pubkeys_nodeRRt text_nodetpk_nodetcurRR((sE/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.pytload_azure_ovf_pubkeys)s8     c CsSytj|}Wn3tk rH}d|}t|t|nXt|jd}t|dkrtdnt|dkrtdt|n|d}t|d}t|dkrtdnt|dkrtd t|d fn|d}|j s=td nd }iid 6} i} d} d} d} x?|j D]4}|j |j ksr|j rqrn|jj}t}d}t|j dkr|j dj |j krt}|j dj}ntg|jjD]\}}||f^q}|dksH|dkr|jdd%kr~tjdj|j} q|} qr|dkr|} qr|dkr|} qr|dkr|| ds       :             ,                S,$ 5h   @$