HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/cloudinit/config/__pycache__/cc_set_hostname.cpython-310.pyc
o

x[h�
�
@s�UdZddlZddlZddlmZddlmZddlmZddl	m
Z
ddlmZddl
mZdd	lmZd
egegd�Zeed<e�e�ZGd
d�de�Zdede
dededdf
dd�ZdS)z#Set Hostname: Set hostname and FQDN�N)�util)�
write_json)�Cloud)�Config)�
MetaSchema)�ALL_DISTROS)�PER_INSTANCE�cc_set_hostname)�id�distros�	frequency�activate_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�}|dur!|j�d|�t�|dd�}|dur3|j�d|�t�||�\}}}tj�	|�
d�d�}	i}
tj�|	�r^t�|	�j
dkr^t�t�|	��}
||
�d	�kpk||
�d
�k}|sut�d�dS|r�|dkr�t�d
�dSt�d||�z	|j�||�Wn!ty�}zd||f}
t�t|
�td|
|f�|�d}~wwt|	||d��dS)N�preserve_hostnameFzVConfiguration option 'preserve_hostname' is set, not setting the hostname in module %s�prefer_fqdn_over_hostname�create_hostname_file�datazset-hostnamer�hostname�fqdnz*No hostname changes. Skipping set_hostname�	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 )r�get_cfg_option_bool�LOG�debug�distro�
set_option�get_hostname_fqdn�os�path�join�	get_cpath�exists�stat�st_size�	load_json�load_text_file�get�set_hostname�	Exception�logexcrr)rrrr�
hostname_fqdnrrr �
is_default�prev_fn�
prev_hostname�hostname_changed�e�msgrrr�handle'sT�����

��r<)r�loggingr(�	cloudinitr�cloudinit.atomic_helperr�cloudinit.cloudr�cloudinit.configr�cloudinit.config.schemar�cloudinit.distrosr�cloudinit.settingsrr�__annotations__�	getLoggerrr#r3r�str�listr<rrrr�<module>s$�
"