/usr/lib/python3.6/site-packages/cloudinit/sources/helpers/__pycache__
Edit: /usr/lib/python3.6/site-packages/cloudinit/sources/helpers/__pycache__/digitalocean.cpython-36.pyc (6099B)
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
C s z&get_link_local_nic..c S s t j| dS )NZifindex)cloudnetZread_sys_net_int)dr r r I s z$get_link_local_nic..)key)r" Zget_devicelistmin)r Znicsr )r r r A s
r c C s| | st jd dS t jd dddd| g}ytj| t jd| W n2 tk
rv } ztjt d | | W Y dd}~X nX dS )
zwRemove the ip4LL address. While this is not necessary, the ip4LL
address is extraneous and confusing to users.
zLno link_local address interface defined, skipping link local address cleanupNzcleaning up ipv4LL addressr r flushr zremoved ip4LL addresses from %sz)failed to remove ip4LL address from '%s'.)r r r r r r )r r er r r del_ipv4_link_localL s
r) c C sd dd }g }t j }tjd| x| D ]
}| | d }tjd| |jd}||krhtd||f |j|}|jdd } tj| |}
|
|krtjd
| |||
nd}tj||| d||
d
}g }
xJdD ]B}|j|d}|sq||}| dks d|kr|d= |
j| qW |
|d<