File: //lib/python3/dist-packages/cloudinit/sources/helpers/__pycache__/digitalocean.cpython-310.pyc
o
x[h� � @ s� d dl Z d dlZd dlZd dlmZ d dlmZ d dlmZmZ ddd�Z e�
e�Zddd �Z
d
d� Zddd
�Zdd� Zddd�Zdd� ZdS )� N)�dmi)�net)�
url_helper�util�eth0�eth1)�public�privatec C s� |st | �}t�d|� |std��d�t�dd�t�dd��}z| j�||� | j� |� t�d||� W |S t
yG t�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_local s0 �����r c s. � fdd�t �� D �}|sd S t|dd� d�S )Nc s g | ]
}� j �|�r|�qS r )�
networking�is_physical)�.0�f�r r r �
<listcomp>9 s
��z&get_link_local_nic.<locals>.<listcomp>c S s t �| d�S )N�ifindex)�cloudnet�read_sys_net_int)�dr r r �<lambda>@ s z$get_link_local_nic.<locals>.<lambda>)�key)r&