HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/lib/python3/dist-packages/cloudinit/config/__pycache__/cc_set_hostname.cpython-38.pyc
U

Ӈg�
�@s�UdZddlZddlZddlmZddlmZddlmZddl	m
Z
ddlmZddl
mZdd	lmZd
egegd�Zeed<e�e�ZGd
d�de�Zee
eedd�dd�ZdS)z#Set Hostname: Set hostname and FQDN�N)�util)�
write_json)�Cloud)�Config)�
MetaSchema)�ALL_DISTROS)�PER_INSTANCEZcc_set_hostname)�idZdistrosZ	frequencyZactivate_by_schema_keys�metac@seZdZdZdS)�SetHostnameErrorz�Raised when the distro runs into an exception when setting hostname.

    This may happen if we attempt to set the hostname early in cloud-init's
    init-local timeframe as certain services may not be running yet.
    N)�__name__�
__module__�__qualname__�__doc__�rr�B/usr/lib/python3/dist-packages/cloudinit/config/cc_set_hostname.pyrsr)�name�cfg�cloud�args�returnc
Cs�t�|dd�rt�d|�dSt�|dd�}|dk	rB|j�d|�t�|dd�}|dk	rf|j�d|�t�||�\}}}tj�	|�
d�d�}	i}
tj�|	�r�t�|	�j
dkr�t�t�|	��}
||
�d	�kp�||
�d
�k}|s�t�d�dS|�r|dk�rt�d
�dSt�d||�z|j�||�WnNtk
�rv}z.d||f}
t�t|
�td|
|f�|�W5d}~XYnXt|	||d��dS)NZpreserve_hostnameFzVConfiguration option 'preserve_hostname' is set, not setting the hostname in module %sZprefer_fqdn_over_hostname�create_hostname_file�datazset-hostnamer�hostname�fqdnz*No hostname changes. Skipping set_hostnameZ	localhostz6Hostname is localhost. Let other services handle this.zSetting the hostname to %s (%s)z%Failed to set the hostname to %s (%s)z%s: %s)rr)rZget_cfg_option_bool�LOG�debugZdistroZ
set_optionZget_hostname_fqdn�os�path�joinZ	get_cpath�exists�stat�st_sizeZ	load_jsonZload_text_file�getZset_hostname�	ExceptionZlogexcrr)rrrrZ
hostname_fqdnrrrZ
is_defaultZprev_fnZ
prev_hostnameZhostname_changed�e�msgrrr�handle'sX�����

$r')rZloggingrZ	cloudinitrZcloudinit.atomic_helperrZcloudinit.cloudrZcloudinit.configrZcloudinit.config.schemarZcloudinit.distrosrZcloudinit.settingsrr
�__annotations__Z	getLoggerrrr$r�str�listr'rrrr�<module>s"�