Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.52 (Ubuntu)
System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64
User : www-data ( 33)
PHP Version : 8.1.2-1ubuntu2.21
Disable Function : NONE
Directory :  /lib/python3/dist-packages/cloudinit/sources/helpers/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/cloudinit/sources/helpers/__pycache__/digitalocean.cpython-310.pyc
o

}��f��@s�ddlZddlZddlZddlmZddlmZddlmZmZddd�Z	e�
e�Zddd	�Z
d
d�Zddd
�Zdd�Zddd�Zdd�ZdS)�N)�dmi)�net)�
url_helper�util�eth0�eth1)�public�privatec	Cs�|st|�}t�d|�|std��d�t�dd�t�dd��}z|j�||�|j�	|�t�d||�W|St
yGt�td	||��w)
z�Bring up NIC using an address using link-local (ip4LL) IPs.
    On DigitalOcean, the link-local domain is per-droplet routed, so there
    is no risk of collisions. However, to be more safe, the ip4LL
    address is random.
    z,selected interface '%s' for reading metadatazPunable to find interfaces to access themeta-data server. This droplet is broken.z169.254.{0}.{1}/16��r�z&brought device '%s' up with address %szRip4LL address assignment of '%s' to '%s' failed. Droplet networking will be broken)
�get_link_local_nic�LOG�debug�RuntimeError�format�random�randint�net_ops�add_addr�link_up�	Exceptionr�logexc)�distro�nic�addr�r�H/usr/lib/python3/dist-packages/cloudinit/sources/helpers/digitalocean.py�assign_ipv4_link_locals0�����rcs.�fdd�t��D�}|sdSt|dd�d�S)Ncsg|]
}�j�|�r|�qSr)�
networking�is_physical)�.0�f�rrr�
<listcomp>9s
��z&get_link_local_nic.<locals>.<listcomp>cSst�|d�S)N�ifindex)�cloudnet�read_sys_net_int)�drrr�<lambda>@sz$get_link_local_nic.<locals>.<lambda>)�key)r&�get_devicelist�min)r�nicsrr#rr
8s
�r
c
Csr|s	t�d�dSt�d�z|j�|�t�d|�WdSty8}zt�td||�WYd}~dSd}~ww)zwRemove the ip4LL address. While this is not necessary, the ip4LL
    address is extraneous and confusing to users.
    zLno link_local address interface defined, skipping link local address cleanupNzcleaning up ipv4LL addresszremoved ip4LL addresses from %sz)failed to remove ip4LL address from '%s'.)rrr�
flush_addrrrr)rr�errr�del_ipv4_link_localCs�
��r0cCsRdd�}g}t��}t�d|�|D]�}||d}t�d|�|�d�}||vr1td||f��|�|�}|�dd	�}	t�|	|�}
|
|krPt�d
|	|||
�n	d}t�|||�d||
d
�}g}
dD]}|�|d�}|snqc||�}|	dkszd|vr}|d=|
�|�qc|
|d<|�|�t�d|
|�q|r�t�d|�|�d|d��d|d�S)a}Convert the DigitalOcean Network description into Cloud-init's netconfig
    format.

    Example JSON:
     {'public': [
           {'mac': '04:01:58:27:7f:01',
            'ipv4': {'gateway': '45.55.32.1',
                     'netmask': '255.255.224.0',
                     'ip_address': '45.55.50.93'},
            'anchor_ipv4': {
                     'gateway': '10.17.0.1',
                     'netmask': '255.255.0.0',
                     'ip_address': '10.17.0.9'},
            'type': 'public',
            'ipv6': {'gateway': '....',
                     'ip_address': '....',
                     'cidr': 64}}
        ],
       'private': [
           {'mac': '04:01:58:27:7f:02',
            'ipv4': {'gateway': '10.132.0.1',
                     'netmask': '255.255.0.0',
                     'ip_address': '10.132.75.35'},
            'type': 'private'}
        ]
     }
    cSsZdd|�d�|�d�d�}d|�d�vr$d�|�d�|�d��|d	<|S|�d
�|d
<|S)N�static�auto�
ip_address�gateway)�type�control�addressr4�:z{0}/{1}�cidrr7�netmask)�getr)�pcfg�subpartrrr�_get_subnet_partus���z7convert_network_configuration.<locals>._get_subnet_partznic mapping: %srzconsidering %s�maczVDid not find network interface on system with mac '%s'. Cannot apply configuration: %sr5�unknownz6Found %s interface '%s' on '%s', assigned name of '%s'zfFound interface '%s' on '%s', which is not a public or private interface. Using default system naming.�physical)r5�mac_address�name)�ipv4�ipv6�anchor_ipv4�anchor_ipv6Nr�anchorr4�subnetsznic '%s' configuration: %szadded dns servers: %s�
nameserver)r5r7r
)�version�config)r&�get_interfaces_by_macrrr;r�NIC_MAP�append)rL�dns_serversr>�nic_configs�macs_to_nics�nrrB�
sysfs_name�nic_type�if_name�msg�ncfgrI�netdef�
raw_subnet�sub_partrrr�convert_network_configurationXs`
��
�	��

r\��cCs6tj||||d�}|��std|��t�|j���S)N)�timeout�sec_between�retrieszunable to read metadata at %s)r�readurl�okr�json�loads�contents�decode)�urlr_r`ra�responserrr�
read_metadata�s�rjcCsNt�d�}|dkrdSt�d�}|rt�d|�d|fSd}t�|�t|��)Nzsystem-manufacturer�DigitalOcean)FNzsystem-serial-numberz8system identified via SMBIOS as DigitalOcean Droplet: %sz�system identified via SMBIOS as a DigitalOcean Droplet, but did not provide an ID. Please file a support ticket at: https://cloud.digitalocean.com/support/tickets/newT)r�
read_dmi_datarr�criticalr)�vendor_name�
droplet_idrWrrr�read_sysinfo�s

���
rp)N)r]r]r^)rd�loggingr�	cloudinitrrr&rrrN�	getLogger�__name__rrr
r0r\rjrprrrr�<module>s


&

n	

Spamworldpro Mini