HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //lib/python3.6/site-packages/cloudinit/config/__pycache__/cc_update_hostname.cpython-36.pyc
3

\�me{�@s�UdZddlZddlZddlmZddlmZddlmZddl	m
Z
ddlmZm
Z
ddlmZd	Zd
gZddd
eeed�ed�ed�ed�ed�gegd�Zee
e�Zeje�Zee
eedd�dd�ZdS)z)Update Hostname: Update hostname and fqdn�N)�dedent)�util)�Cloud)�Config)�
MetaSchema�get_meta_doc)�
PER_ALWAYSz�This module will update the system hostname and fqdn. If ``preserve_hostname``
is set ``true``, then the hostname will not be altered.

.. note::
    for instructions on specifying hostname and fqdn, see documentation for
    ``cc_set_hostname``
�allZcc_update_hostnamezUpdate HostnamezUpdate hostname and fqdna�        # By default: when ``preserve_hostname`` is not specified cloud-init
        # updates ``/etc/hostname`` per-boot based on the cloud provided
        # ``local-hostname`` setting. If you manually change ``/etc/hostname``
        # after boot cloud-init will no longer modify it.
        #
        # This default cloud-init behavior is equivalent to this cloud-config:
        preserve_hostname: false
        zh        # Prevent cloud-init from updating the system hostname.
        preserve_hostname: true
        ze        # Prevent cloud-init from updating ``/etc/hostname``
        preserve_hostname: true
        z�        # Set hostname to "external.fqdn.me" instead of "myhost"
        fqdn: external.fqdn.me
        hostname: myhost
        prefer_fqdn_over_hostname: true
        z�        # Set hostname to "external" instead of "external.fqdn.me" when
        # cloud metadata provides the ``local-hostname``: "external.fqdn.me".
        prefer_fqdn_over_hostname: false
        )�id�name�title�description�distrosZexamplesZ	frequencyZactivate_by_schema_keys)r�cfg�cloud�args�returnc
Cs�tj|dd�rtjd|�dStj|dd�}|dk	rB|jjd|�tj|dd�}|dk	rf|jjd|�tj||�\}}}|r�|dkr�tjd�dSy6tjj	|j
d�d	�}	tjd
||�|jj|||	�Wn&tk
r�tj
td||��YnXdS)NZpreserve_hostnameFzWConfiguration option 'preserve_hostname' is set, not updating the hostname in module %sZprefer_fqdn_over_hostname�create_hostname_fileZ	localhostz6Hostname is localhost. Let other services handle this.�datazprevious-hostnamezUpdating hostname to %s (%s)z(Failed to update the hostname to %s (%s))rZget_cfg_option_bool�LOG�debugZdistroZ
set_optionZget_hostname_fqdn�os�path�joinZ	get_cpathZupdate_hostname�	ExceptionZlogexc)
rrrrZ
hostname_fqdnrZhostnameZfqdnZ
is_defaultZprev_fn�r�(/usr/lib/python3.6/cc_update_hostname.py�handleVs2


r)�__doc__Zloggingr�textwraprZ	cloudinitrZcloudinit.cloudrZcloudinit.configrZcloudinit.config.schemarrZcloudinit.settingsrZMODULE_DESCRIPTIONr�metaZ	getLogger�__name__r�str�listrrrrr�<module>	s<