Ë
    x[hõ  ã            
       óÆ   — U d Z ddlZddlmZmZmZ ddlmZ ddlm	Z	 ddl
mZ ddlmZ ddlmZ g d	¢Zd
egedgdœZeed<    ej&                  e«      Zdede	dededdf
d„Zy)zPhone Home: Post data to urlé    N)Ú	templaterÚ
url_helperÚutil)ÚCloud)ÚConfig)Ú
MetaSchema)ÚALL_DISTROS)ÚPER_INSTANCE)Úpub_key_rsaÚpub_key_ecdsaÚpub_key_ed25519Úinstance_idÚhostnameÚfqdnÚcc_phone_homeÚ
phone_home)ÚidÚdistrosÚ	frequencyÚactivate_by_schema_keysÚmetaÚnameÚcfgÚcloudÚargsÚreturnc           	      ó¬  — |rt        j                  |d   «      }n d|vrt        j                  d| «       y |d   }d|vrt        j	                  d| «       y |d   }|j                  dd«      }|j                  d«      }	 t        |«      }|dk(  rt        }|j                  «       |j                  «       j                  |j                  d¬«      j                  dœ}ddddœ}	|	j                  «       D ]  \  }
}	 t        j                  |«      ||
<   Œ  i }|D ]*  }||v r	||   ||<   Œd ||<   t        j	                  d|«       Œ, i }|j                  «       D ]  \  }}|€d||<   Œt#        |«      ||<   Œ d|d   i}t%        j&                  ||«      }	 t)        j*                  |||dz
  dt        j,                  |j.                  «      ¬«       y # t        t        f$ r! d	}t        j                  t        d
|«       Y �Œqw xY w# t         $ r t        j                  t        d|«       Y �Œ5w xY w# t         $ r t        j                  t        d||«       Y y w xY w)Nr   r   z=Skipping module named %s, no 'phone_home' configuration foundÚurlzFSkipping module named %s, no 'url' found in 'phone_home' configurationÚpostÚallÚtriesé
   z?Configuration entry 'tries' is not an integer, using %s insteadT)r   )r   r   r   z/etc/ssh/ssh_host_rsa_key.pubz/etc/ssh/ssh_host_ecdsa_key.pubz!/etc/ssh/ssh_host_ed25519_key.pub)r   r   r   z1%s: failed to open, can not phone home that data!z=Requested key %s from 'post' configuration list not availablezN/AÚINSTANCE_IDr   é   é   )ÚdataÚretriesÚsec_betweenÚssl_detailsz0Failed to post phone home data to %s in %s tries)r   Ú	read_confÚLOGÚdebugÚwarningÚgetÚintÚ
ValueErrorÚ	TypeErrorÚlogexcÚPOST_LIST_ALLÚget_instance_idÚget_hostnamer   ÚitemsÚload_text_fileÚ	ExceptionÚstrr   Úrender_stringr   Úread_file_or_urlÚfetch_ssl_detailsÚpaths)r   r   r   r   Úph_cfgr   Ú	post_listr!   Úall_keysÚpubkeysÚnÚpathÚsubmit_keysÚkÚreal_submit_keysÚvÚ
url_paramss                    ú@/usr/lib/python3/dist-packages/cloudinit/config/cc_phone_home.pyÚhandlerJ   1   s�  € ÙÜ—‘  Q¡Ó(‰à˜sÑ"Ü�I‰Ið6àôð
 Ø�\Ñ"ˆà�FÑÜ�‰ð;àô	
ð
 	à
�‰-€CØ—
‘
˜6 5Ó)€IØ�J‰J�wÓ€Eð
Ü�E“
ˆð �EÒÜ!ˆ	ð ×,Ñ,Ó.Ø×&Ñ&Ó(×1Ñ1Ø×"Ñ"¨Ð"Ó-×6Ñ6ñ€Hð 7Ø:Ø>ñ€Gð —=‘=“?ò ‰ˆˆ4ð	Ü×-Ñ-¨dÓ3ˆH�QŠKðð €KØò 	ˆØ�‰=Ø% a™[ˆK˜ŠNà!ˆK˜‰NÜ�K‰Kð4àõð	ð ÐØ×!Ñ!Ó#ò )‰ˆˆ1Øˆ9Ø"'Ð˜QÒä"% a£&Ð˜QÒð	)ð 	�x Ñ.ð€Jô ×
!Ñ
! # zÓ
2€Cð
Ü×#Ñ#ØØ!Ø˜A‘IØÜ×.Ñ.¨u¯{©{Ó;ö	
øôs œ	Ð"ò 
ØˆÜ�‰ÜØMØ÷	
ð
ûô4 ò 	Ü�K‰KÜÐHÈ$÷ð	ûôL ò 
Ü�‰ÜÐCÀSÈ%ö	
ð
ús6   Â G Ã9H Æ:H+ Ç,G=Ç<G=È $H(È'H(È+%IÉI)Ú__doc__ÚloggingÚ	cloudinitr   r   r   Úcloudinit.cloudr   Úcloudinit.configr   Úcloudinit.config.schemar   Úcloudinit.distrosr	   Úcloudinit.settingsr
   r3   r   Ú__annotations__Ú	getLoggerÚ__name__r+   r9   ÚlistrJ   © ó    rI   ú<module>rY      s‹   ðò #ã ç 1Ñ 1Ý !Ý #Ý .Ý )Ý +ò€ð Øˆ}ØØ ,˜~ñ	€€jó ð €g×Ñ˜Ó!€ð]
�ð ]
˜6ð ]
¨%ð ]
°tð ]
Àô ]
rX   