3
\meE @ s d dl Z d dlZd dlZd dlmZ d dlmZ d dlmZmZm Z dddZ
ejeZ
ddd Zd
d Zddd
Zdd ZdddZdd ZdS ) N)dmi)net)subp
url_helperutilZeth0Zeth1)publicZprivatec C s |st | }tjd| |s$tddjtjddtjdd}dd d
|d|g}ddd
d|dg}tjdsrtdy2tj| tjd|| tj| tjd| W n& t k
r t
jtd|| Y nX |S )zBring 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 ipaddradddevlinksetZupz4No '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_nicLOGdebugRuntimeErrorformatrandomZrandintr Zwhich Exceptionr logexc)distronicr ip_addr_cmdZip_link_cmd r "/usr/lib/python3.6/digitalocean.pyassign_ipv4_link_local s4
r c s. fddt j D }|sd S t|dd dS )Nc s g | ]} j j|r|qS r )Z
networkingZis_physical).0f)r r r