| Server IP : 23.254.227.96 / Your IP : 216.73.216.183 Web Server : Apache/2.4.62 (Unix) OpenSSL/1.1.1k System : Linux hwsrv-1277026.hostwindsdns.com 4.18.0-477.13.1.el8_8.x86_64 #1 SMP Tue May 30 14:53:41 EDT 2023 x86_64 User : viralblo ( 1001) PHP Version : 8.1.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/lib/python3.6/site-packages/cloudinit/sources/helpers/__pycache__/ |
Upload File : |
3
��br � @ s� d dl Z d dlZd dlmZ d dlmZ d dlmZ d dlmZm Z m
Z
ddd�Zeje
�Zdd d
�Zdd� Zdd
d�Zdd� Zddd�Zdd� ZdS )� N)�dmi)�log)�net)�subp�
url_helper�utilZeth0Zeth1)�publicZprivatec C s� |st | �}tjd|� |s$td��djtjdd�tjdd��}dd d
|d|g}ddd
d|dg}tjd�srtd��y2tj|� tjd||� tj|� tjd|� W n& t k
r� t
jtd||� � 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 �"/usr/lib/python3.6/digitalocean.py�assign_ipv4_link_local s4
r c s. � fdd�t j� D �}|sd S t|dd� d�S )Nc s g | ]}� j j|�r|�qS r )Z
networkingZis_physical)�.0�f)r r r �
<listcomp>C s z&get_link_local_nic.<locals>.<listcomp>c S s t j| d�S )NZifindex)�cloudnetZread_sys_net_int)�dr r r �<lambda>I s z$get_link_local_nic.<locals>.<lambda>)�key)r# Zget_devicelist�min)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| |�}
|
|kr�tjd
| |||
� nd}tj|||� d||
d
�}g }
xJdD ]B}|j|d�}|s�q�||�}| dk�s d|k�r|d= |
j|� q�W |
|d<