| Current Path : /lib/python3/dist-packages/cloudinit/sources/helpers/__pycache__/ |
| Current File : //lib/python3/dist-packages/cloudinit/sources/helpers/__pycache__/digitalocean.cpython-38.pyc |
U
�Adr � @ s� d dl Z d dlZd dlmZ d dlmZ d dlmZ d dlmZm Z m
Z
ddd�Ze�e
�Zdd d
�Zdd� Zdd
d�Zdd� Zddd�Zdd� ZdS )� N)�dmi)�log)�net)�subp�
url_helper�utilZeth0Zeth1)�publicZprivatec C s� |st | �}t�d|� |s$td��d�t�dd�t�dd��}dd d
|d|g}ddd
d|dg}t�d�srtd��z2t�|� t�d||� t�|� t�d|� W n& t k
r� t
�td||� � Y nX |S )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 � �ip�addr�add�dev�link�setZupz4No 'ip' command available to configure ip4LL addressz#assigned ip4LL address '%s' to '%s'zbrought device '%s' upzRip4LL address assignment of '%s' to '%s' failed. Droplet networking will be broken)�get_link_local_nic�LOG�debug�RuntimeError�format�randomZrandintr Zwhich� Exceptionr �logexc)�distro�nicr
�ip_addr_cmdZip_link_cmd� r �H/usr/lib/python3/dist-packages/cloudinit/sources/helpers/digitalocean.py�assign_ipv4_link_local s>