HEX
Server: Apache/2.4.67 (Debian)
System: Linux vps-b2547eb4 6.1.0-41-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.158-1 (2025-11-09) x86_64
User: root (0)
PHP: 8.2.31
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/cloudinit/sources/__pycache__/DataSourceUpCloud.cpython-311.pyc
�

܍~c6���ddlmZddlmZddlmZmZddlmZddl	m
Z
ddlmZ
eje��ZddiZd	Zd
Zd
ZGd�dej��ZGd
�de��ZeejffeejejffgZd�ZdS)�)�log)�net)�sources�util)�NoDHCPLeaseError)�EphemeralDHCPv4)�upcloud�metadata_urlz'http://169.254.169.254/metadata/v1.json��c�J�eZdZdZdZd�Zd�Zd�Zd�Zd�Z	e
d���Zd	S)
�DataSourceUpCloud�UpCloudFc��tj�||||��||_t	��|_t
jt
j|ddgi��tg��|_
|j
d|_|j
�dt��|_|j
�dt��|_|j
�dt"��|_d|_dS)N�
datasourcerr
�retries�timeout�
wait_retry)r�
DataSource�__init__�distro�dict�metadatar�
mergemanydict�get_cfg_by_path�BUILTIN_DS_CONFIG�ds_cfg�metadata_address�get�
MD_RETRIESr�
MD_TIMEOUTr�
MD_WAIT_RETRYr�_network_config)�self�sys_cfgr�pathss    �E/usr/lib/python3/dist-packages/cloudinit/sources/DataSourceUpCloud.pyrzDataSourceUpCloud.__init__!s�����#�#�D�'�6�5�A�A�A��������
��(��$�W�|�Y�.G��L�L�!�
�
�
���!%��N� ;����{���y�*�=�=����{���y�*�=�=����+�/�/�,�
�F�F���#�����c�(�tj��S�N)�	uc_helper�read_sysinfo�r$s r'�_get_sysinfozDataSourceUpCloud._get_sysinfo1s���%�'�'�'r(c�Z�tj|j|j|j|j���S)N)r�sec_betweenr)r+�
read_metadatarrrrr-s r'�_read_metadataz DataSourceUpCloud._read_metadata4s1���&��!��L����L�	
�
�
�	
r(c�X�|���\}}|sdSt�d|��|jr�	t�d��tj��}t�d|��t||j�	�����5tjtjd|j���}ddd��n#1swxYwYn�#ttjf$r2}tjtt#|����Yd}~dSd}~wwxYw	t�d��tjtjd|j���}n_#tj$rM}tjtt#|����t�d	|��Yd}~dSd}~wwxYw||_|�d
|��|jd<|�d��|jd
<|�d��|jd<|�d��|jd<|�dd��|jd<|�dd��|_|�dd��|_dS)NFz"Running on UpCloud. server_uuid=%szFinding a fallback NICz*Discovering metadata via DHCP interface %s)�tmp_dirzReading from metadata service)�logfunc�msg�funcz7Discovering metadata without DHCP-configured networkingzENo DHCP-enabled interfaces available, unable to fetch metadata for %s�instance_idzinstance-id�hostnamezlocal-hostname�network�public_keyszpublic-keys�region�default�availability_zone�vendor_data�	user_dataT)r.�LOG�info�perform_dhcp_setup�debug�cloudnet�find_fallback_nicrr�get_tmp_exec_pathr�log_timer2rr�InvalidMetaDataException�logexc�str�
metadata_fullrr�vendordata_raw�userdata_raw)r$�
is_upcloud�server_uuid�nic�md�es      r'�	_get_datazDataSourceUpCloud._get_data<s���$(�$5�$5�$7�$7�!��[��	��5����5�{�C�C�C��"�!	�
��	�	�2�3�3�3��0�2�2���	�	�F��L�L�L�$����!>�!>�!@�!@�������� #�	�;�!�0����B���������������������%�g�&F�G�
�
�
���C��Q���(�(�(��u�u�u�u�u�����
����
��	�	�M�����]��I�7��,�������
�3�
�
�
���C��Q���(�(�(����6�����
�u�u�u�u�u�����
���� ���')�v�v�m�[�'I�'I��
�m�$�*,�&�&��*<�*<��
�&�'�#%�6�6�)�#4�#4��
�i� �')�v�v�m�'<�'<��
�m�$�-/�V�V�H�i�-H�-H��
�)�*� �f�f�]�D�9�9����F�F�;��5�5����tsV�A0C.�/'C"�C.�"C&�&C.�)C&�*C.�.D6�'D1�1D6�:AE;�;G�
AG�Gc�N�tj|�����Sr*)r�instance_id_matches_system_uuid�get_instance_id)r$r%s  r'�check_instance_idz#DataSourceUpCloud.check_instance_idss���6�t�7K�7K�7M�7M�N�N�Nr(c��|jr|jS|j�d��}|std���t	j|��|_|jS)z�
        Configure the networking. This needs to be done each boot,
        since the IP and interface information might have changed
        due to reconfiguration.
        r:z/Unable to get network meta-data from server....)r#rr�	Exceptionr+�convert_network_config)r$�raw_network_configs  r'�network_configz DataSourceUpCloud.network_configvsi����	(��'�'�!�]�.�.�y�9�9��!�	O��M�N�N�N�(�?�� 
� 
����#�#r(N)�__name__�
__module__�__qualname__�dsnamerCrr.r2rTrX�propertyr]�r(r'rrs�������
�F���$�$�$� (�(�(�
�
�
�5�5�5�nO�O�O��$�$��X�$�$�$r(rc��eZdZdZdZdS)�DataSourceUpCloudLocalaz
    Run in init-local using a DHCP discovery prior to metadata crawl.

    In init-local, no network is available. This subclass sets up minimal
    networking with dhclient on a viable nic so that it can talk to the
    metadata service. If the metadata service provides network configuration
    then render the network configuration for that instance based on metadata.
    TN)r^r_r`�__doc__rCrcr(r'rere�s"�����������r(rec�6�tj|t��Sr*)r�list_from_depends�datasources)�dependss r'�get_datasource_listrk�s���$�W�k�:�:�:r(N)�	cloudinitr�loggingrrErr�cloudinit.net.dhcpr�cloudinit.net.ephemeralr�cloudinit.sources.helpersr	r+�	getLoggerr^rArr r!r"rrre�DEP_FILESYSTEM�DEP_NETWORKrirkrcr(r'�<module>rtsL��%�$�$�$�$�$�%�%�%�%�%�%�#�#�#�#�#�#�#�#�/�/�/�/�/�/�3�3�3�3�3�3�:�:�:�:�:�:��g���!�!��#�%N�O���
�
�
��
�o$�o$�o$�o$�o$��*�o$�o$�o$�d
�
�
�
�
�.�
�
�
��g�4�6�7���/��1D�E�F���;�;�;�;�;r(