o
    ¦®ØfÆ  ã                
   @   s–   U d Z ddlZddl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 dd	ge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 Hostname: Update hostname and fqdné    N)Úutil)ÚCloud)ÚConfig)Ú
MetaSchema)Ú
PER_ALWAYSÚcc_update_hostnameÚall)ÚidÚdistrosÚ	frequencyÚactivate_by_schema_keysÚmetaÚnameÚcfgÚcloudÚargsÚreturnc           
   	   C   sì   t  |dd¡rt d| ¡ d S t  |dd ¡}|d ur!|j d|¡ t  |dd ¡}|d ur3|j d|¡ t  ||¡\}}}|rI|dkrIt d¡ d S ztj 	| 
d¡d	¡}	t d
||¡ |j |||	¡ W d S  tyu   t  td||¡ ‚ w )NÚpreserve_hostnameFzWConfiguration option 'preserve_hostname' is set, not updating the hostname in module %sÚprefer_fqdn_over_hostnameÚcreate_hostname_fileÚ	localhostz6Hostname is localhost. Let other services handle this.Údatazprevious-hostnamezUpdating hostname to %s (%s)z(Failed to update the hostname to %s (%s))r   Úget_cfg_option_boolÚLOGÚdebugÚdistroÚ
set_optionÚget_hostname_fqdnÚosÚpathÚjoinÚ	get_cpathÚupdate_hostnameÚ	ExceptionÚlogexc)
r   r   r   r   Úhostname_fqdnr   ÚhostnameÚfqdnÚ
is_defaultÚprev_fn© r*   úE/usr/lib/python3/dist-packages/cloudinit/config/cc_update_hostname.pyÚhandle   s<   ýÿÿ
ÿür,   )Ú__doc__Úloggingr   Ú	cloudinitr   Úcloudinit.cloudr   Úcloudinit.configr   Úcloudinit.config.schemar   Úcloudinit.settingsr   r   Ú__annotations__Ú	getLoggerÚ__name__r   ÚstrÚlistr,   r*   r*   r*   r+   Ú<module>   s   ü
"