OS : Linux
PHP Version : 7.4.33
Software : Apache/2.4.6 (CentOS) PHP/7.4.33
Information System : Linux apprendre2 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
Disable Function : ó
oBú]c @ sU d Z d d l Z d d l m Z d d l m Z d e f d „ ƒ YZ d „ Z d S( s
Set Hostname
------------
**Summary:** set hostname and fqdn
This module handles setting the system hostname and fqdn. If
``preserve_hostname`` is set, then the hostname will not be altered.
A hostname and fqdn can be provided by specifying a full domain name under the
``fqdn`` key. Alternatively, a hostname can be specified using the ``hostname``
key, and the fqdn of the cloud wil be used. If a fqdn specified with the
``hostname`` key, it will be handled properly, although it is better to use
the ``fqdn`` config key. If both ``fqdn`` and ``hostname`` are set, ``fqdn``
will be used.
**Internal name:** ``cc_set_hostname``
**Module frequency:** per instance
**Supported distros:** all
**Config keys**::
preserve_hostname:
fqdn:
hostname:
iÿÿÿÿN( t
write_json( t utilt SetHostnameErrorc B s e Z d Z RS( sÛ 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.
( t __name__t
__module__t __doc__( ( ( sD /usr/lib/python2.7/site-packages/cloudinit/config/cc_set_hostname.pyR , s c C sh t j | d t ƒ r) | j d | ƒ d St j | | ƒ \ } } t j j | j d ƒ d ƒ } i } t j j | ƒ r’ t j
t j | ƒ ƒ } n | | j d ƒ k p¹ | | j d ƒ k } | sÓ | j d ƒ d S| j d | | ƒ y | j
j | | ƒ WnI t k
rH}
d | | f } t j | | ƒ t d
| |
f ƒ ‚ n Xt | i | d 6| d 6ƒ d S( Nt preserve_hostnamesV Configuration option 'preserve_hostname' is set, not setting the hostname in module %st datas set-hostnamet hostnamet fqdns* No hostname changes. Skipping set-hostnames Setting the hostname to %s (%s)s% Failed to set the hostname to %s (%s)s %s: %s( R t get_cfg_option_boolt Falset debugt get_hostname_fqdnt ost patht joint get_cpatht existst load_jsont load_filet gett distrot set_hostnamet Exceptiont logexcR R ( t namet cfgt cloudt logt _argsR R t prev_fnt
prev_hostnamet hostname_changedt et msg( ( sD /usr/lib/python2.7/site-packages/cloudinit/config/cc_set_hostname.pyt handle5 s,
( R R t cloudinit.atomic_helperR t cloudinitR R R R$ ( ( ( sD /usr/lib/python2.7/site-packages/cloudinit/config/cc_set_hostname.pyt # s