| Server IP : 23.254.227.96 / Your IP : 216.73.216.183 Web Server : Apache/2.4.62 (Unix) OpenSSL/1.1.1k System : Linux hwsrv-1277026.hostwindsdns.com 4.18.0-477.13.1.el8_8.x86_64 #1 SMP Tue May 30 14:53:41 EDT 2023 x86_64 User : viralblo ( 1001) PHP Version : 8.1.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /lib/python3.6/site-packages/cloudinit/config/__pycache__/ |
Upload File : |
3
��b� � @ s4 d Z ddlZddlmZ ddlmZ eZdd� ZdS )a-
Update Hostname
---------------
**Summary:** update hostname and fqdn
This module will update the system hostname and fqdn. If ``preserve_hostname``
is set, then the hostname will not be altered.
.. note::
for instructions on specifying hostname and fqdn, see documentation for
``cc_set_hostname``
**Internal name:** ``cc_update_hostname``
**Module frequency:** always
**Supported distros:** all
**Config keys**::
preserve_hostname: <true/false>
prefer_fqdn_over_hostname: <true/false>
fqdn: <fqdn>
hostname: <fqdn/hostname>
� N)�util)�
PER_ALWAYSc C s� t j|dd�r|jd| � d S t j|dd �}|d k rB|jjd|� t j||�\}}y6tjj|j d�d�}|jd||� |jj
|||� W n& tk
r� t j|d||� � Y nX d S ) NZpreserve_hostnameFzWConfiguration option 'preserve_hostname' is set, not updating the hostname in module %sZprefer_fqdn_over_hostname�datazprevious-hostnamezUpdating hostname to %s (%s)z(Failed to update the hostname to %s (%s))
r Zget_cfg_option_bool�debugZdistroZ
set_optionZget_hostname_fqdn�os�path�joinZ get_cpathZupdate_hostname� ExceptionZlogexc) �nameZcfgZcloud�logZ_argsZ
hostname_fqdnZhostnameZfqdnZprev_fn� r �(/usr/lib/python3.6/cc_update_hostname.py�handle+ s$
r )�__doc__r Z cloudinitr Zcloudinit.settingsr Z frequencyr r r r r
�<module>! s