관리-도구
편집 파일: cc_set_hostname.cpython-39.pyc
a ����'�Dg� ����������������������@���s����U�d�Z�ddlZddlZddlmZ�ddlmZ�ddlmZ�ddl m Z �ddlmZ�ddl mZ�dd lmZ�d egeg�d�Zeed<�e�e�ZG�d 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�������������������@���s���e�Zd�ZdZdS�)�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__��r���r����D/usr/lib/python3.9/site-packages/cloudinit/config/cc_set_hostname.pyr������s���r���)�name�cfg�cloud�args�returnc�������������� ���C���s���t��|dd�rt�d|���d�S�t��|dd��}|d�urB|j�d|��t��|dd��}|d�urf|j�d|��t��||�\}}}tj� |� d�d�} i�} tj�| �r�t�| �j dkr�t��t��| ��} || �d �kp�|| �d �k}|s�t�d��d�S�|�r|dk�rt�d ��d�S�t�d||��z|j�||��W�nP�t�yx�}�z6d||f�} t��t| ��td| |f��|�W�Y�d�}~n d�}~0�0�t| ||d���d�S�)NZpreserve_hostnameFzVConfiguration option 'preserve_hostname' is set, not setting the hostname in module %sZprefer_fqdn_over_hostname�create_hostname_file�datazset-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)r���r���)r���Zget_cfg_option_bool�LOG�debugZdistroZ set_optionZget_hostname_fqdn�os�path�joinZ get_cpath�exists�stat�st_sizeZ load_jsonZload_text_file�getZset_hostname� ExceptionZlogexcr���r���)r���r���r���r���Z hostname_fqdnr���r���r���Z is_defaultZprev_fnZ prev_hostnameZhostname_changed�e�msgr���r���r����handle'���sP��������� (r'���)r���Zloggingr���Z cloudinitr���Zcloudinit.atomic_helperr���Zcloudinit.cloudr���Zcloudinit.configr���Zcloudinit.config.schemar���Zcloudinit.distrosr���Zcloudinit.settingsr���r ����__annotations__Z getLoggerr���r���r$���r����str�listr'���r���r���r���r����<module>���s"����