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__/upcloud.cpython-310.pyc
o

}��f��@sdddlZddlZddlmZddlmZddlmZe�e�Z	dd�Z
dd�Zddd�Zd
d�Z
dS)�N)�dmi)�net)�
url_helperc
Csdd�}g}t��}t�d|�|�d�D]U}t�d|�|�d�}||vr.td||f��|�d�}|�|�}t�d	||||�d
��d||d�}g}	|�d
�D]}
||
|�d��}|	�|�qQ|	|d<|�|�q|�d�r�t�d|�d��|�d|�d�d��d|d�S)aC

    Convert the UpCloud network metadata description into
    Cloud-init's version 1 netconfig format.

    Example JSON:
    {
      "interfaces": [
        {
          "index": 1,
          "ip_addresses": [
            {
              "address": "94.237.105.53",
              "dhcp": true,
              "dns": [
                "94.237.127.9",
                "94.237.40.9"
              ],
              "family": "IPv4",
              "floating": false,
              "gateway": "94.237.104.1",
              "network": "94.237.104.0/22"
            },
            {
              "address": "94.237.105.50",
              "dhcp": false,
              "dns": [],
              "family": "IPv4",
              "floating": true,
              "gateway": "",
              "network": "94.237.105.50/32"
            }
          ],
          "mac": "32:d5:ba:4a:36:e7",
          "network_id": "031457f4-0f8c-483c-96f2-eccede02909c",
          "type": "public"
        },
        {
          "index": 2,
          "ip_addresses": [
            {
              "address": "10.6.3.27",
              "dhcp": true,
              "dns": [],
              "family": "IPv4",
              "floating": false,
              "gateway": "10.6.0.1",
              "network": "10.6.0.0/22"
            }
          ],
          "mac": "32:d5:ba:4a:84:cc",
          "network_id": "03d82553-5bea-4132-b29a-e1cf67ec2dd1",
          "type": "utility"
        },
        {
          "index": 3,
          "ip_addresses": [
            {
              "address": "2a04:3545:1000:720:38d6:baff:fe4a:63e7",
              "dhcp": true,
              "dns": [
                "2a04:3540:53::1",
                "2a04:3544:53::1"
              ],
              "family": "IPv6",
              "floating": false,
              "gateway": "2a04:3545:1000:720::1",
              "network": "2a04:3545:1000:720::/64"
            }
          ],
          "mac": "32:d5:ba:4a:63:e7",
          "network_id": "03000000-0000-4000-8046-000000000000",
          "type": "public"
        },
        {
          "index": 4,
          "ip_addresses": [
            {
              "address": "172.30.1.10",
              "dhcp": true,
              "dns": [],
              "family": "IPv4",
              "floating": false,
              "gateway": "172.30.1.1",
              "network": "172.30.1.0/24"
            }
          ],
          "mac": "32:d5:ba:4a:8a:e1",
          "network_id": "035a0a4a-77b4-4de5-820d-189fc8135714",
          "type": "private"
        }
      ],
      "dns": [
        "94.237.127.9",
        "94.237.40.9"
      ]
    }
    cSs�|�d�rd}|�d�dkrd}d|iSd}|�d�dkrd}|d|�d	�d
�}|�d�r4|�d�|d<d|�d
�vrG|�d
��d�d|d<||�d�krZ|�d�rZ|�d�|d<|S)N�dhcp�family�IPv6zipv6_dhcpv6-stateless�type�static�static6�auto�address)r�controlr�gateway�/�network��netmask�dns�dns_nameservers)�get�split)�ip_addrr�	dhcp_type�static_type�subpart�r�C/usr/lib/python3/dist-packages/cloudinit/sources/helpers/upcloud.py�_get_subnet_configrs&
�
z8convert_to_network_config_v1.<locals>._get_subnet_configzNIC mapping: %s�
interfaceszConsidering %s�maczVDid not find network interface on system with mac '%s'. Cannot apply configuration: %srz4Found %s interface '%s' with address '%s' (index %d)�index�physical)r�name�mac_address�ip_addressesr�subnetszSetting DNS nameservers to %s�
nameserver)rrr)�version�config)�cloudnet�get_interfaces_by_mac�LOG�debugr�RuntimeError�append)r(r�nic_configs�macs_to_interfaces�	raw_ifacer#�
iface_type�
sysfs_name�	interfacer%�
ip_address�sub_partrrr�convert_to_network_config_v1sLc
��

�	�
�
r7cCst|�S)N)r7)r(rrr�convert_network_config�sr8��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<r=�responserrr�
read_metadata�s�rFcCsNt�d�}|dkrdSt�d�}|rt�d|�d|fSd}t�|�t|��)Nzsystem-manufacturer�UpCloud)FNzsystem-uuidz2system identified via SMBIOS as UpCloud server: %sz�system identified via SMBIOS as a UpCloud server, but did not provide an ID. Please contact support viahttps://hub.upcloud.com or via email with support@upcloud.comT)r�
read_dmi_datar+r,�criticalr-)�vendor_name�server_uuid�msgrrr�read_sysinfo�s

���
rM)r9r9r:)r@�logging�	cloudinitrrr)r�	getLogger�__name__r+r7r8rFrMrrrr�<module>s
2
	

Spamworldpro Mini