o
    x[hÚ	  ã                
   @   s˜   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	ged
gdœZeed< e e¡Zdede	dededdf
dd„ZdS )z@Update Etc Hosts: Update the hosts file (usually ``/etc/hosts``)é    N)Ú	lifecycleÚ	templaterÚutil)ÚCloud)ÚConfig)Ú
MetaSchema)Ú
PER_ALWAYSÚcc_update_etc_hostsÚallÚmanage_etc_hosts)ÚidÚdistrosÚ	frequencyÚactivate_by_schema_keysÚmetaÚnameÚcfgÚcloudÚargsÚreturnc           
      C   sü   t  |dd¡}|jj}t j|dgd�rP|dkrtjdddd� t  ||¡\}}}|s1t 	d	¡ d S | 
d
|jj ¡}	|	sDtd|jj ƒ‚t |	|||dœ¡ d S |dkrut  ||¡\}}}|sft 	d	¡ d S t d|¡ |j ||¡ d S t d|| ¡ d S )Nr   FÚtemplate)Úaddonsz+Value 'template' for key 'manage_etc_hosts'z22.2zUse 'true' instead.)Ú
deprecatedÚdeprecated_versionÚextra_messagez<Option 'manage_etc_hosts' was set, but no hostname was foundzhosts.%sz.No hosts template could be found for distro %s)ÚhostnameÚfqdnÚ	localhostzManaging localhost in %szPConfiguration option 'manage_etc_hosts' is not set, not managing %s in module %s)r   Úget_cfg_option_strÚdistroÚhosts_fnÚtranslate_boolr   Ú	deprecateÚget_hostname_fqdnÚLOGÚwarningÚget_template_filenameÚosfamilyÚRuntimeErrorr   Úrender_to_fileÚdebugÚupdate_etc_hosts)
r   r   r   r   Úmanage_hostsr    r   r   Ú_Útpl_fn_name© r/   úF/usr/lib/python3/dist-packages/cloudinit/config/cc_update_etc_hosts.pyÚhandle   sR   ýÿ
ÿÿÿÿÿür1   )Ú__doc__ÚloggingÚ	cloudinitr   r   r   Úcloudinit.cloudr   Úcloudinit.configr   Úcloudinit.config.schemar   Úcloudinit.settingsr   r   Ú__annotations__Ú	getLoggerÚ__name__r$   ÚstrÚlistr1   r/   r/   r/   r0   Ú<module>   s   ü
"