404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@3.143.1.161: ~ $
3

\�me+�@s�ddlZddlZddlZddlmZmZmZddlmZej	e
�ZeZ
eZGdd�dejd�ZGdd�de�ZGd	d
�d
e�ZGdd�de�ZdS)
�N)�net�subp�util)�ifconfigc@s�eZdZdZed�dd�Zdd�edd�dd	�Zej	e
dd
�dd��Zed
�dd�Z
ed
�dd�Ze
ed
�dd�Zdd�Zdd�ed�dd�Zed�dd�Zed�dd�Zeed�dd �Zed
�d!d"�Zed�d#d$�Zed�d%d&�Zed
�d'd(�Zdd)�eeed*�d+d,�Zeed-�d.d/�Zeed-�d0d1�Zej	eed-�d2d3��Zeed-�d4d5�Zeed-�d6d7�Zeed-�d8d9�Z eed-�d:d;�Z!ej	dd<�dd�d=d>��Z"d?d)�e
edd@�dAdB�Z#ej	eed-�dCdD��Z$dS)E�
NetworkingaThe root of the Networking hierarchy in cloud-init.

    This is part of an ongoing refactor in the cloud-init codebase, for more
    details see "``cloudinit.net`` -> ``cloudinit.distros.networking``
    Hierarchy" in CONTRIBUTING.rst for full details.
    )�returncCstj�S)N)r�_get_current_rename_info)�self�r
� /usr/lib/python3.6/networking.pyrsz#Networking._get_current_rename_infoN)�current_info)�renamesrcCstj||d�S)N)r)r�_rename_interfaces)r	r
rr
r
rrszNetworking._rename_interfaces)�netcfgrcCsdS)z7Read the network config and rename devices accordingly.Nr
)r	rr
r
r�apply_network_config_namessz%Networking.apply_network_config_names)�devnamecCs
tj|�S)N)r�device_devid)r	rr
r
rr#szNetworking.device_devidcCs
tj|�S)N)r�
device_driver)r	rr
r
rr&szNetworking.device_drivercCs
tj|�S)N)r�extract_physdevs)r	rr
r
rr)szNetworking.extract_physdevscCstj�S)N)r�find_fallback_nic)r	r
r
rr,szNetworking.find_fallback_nicF)�
config_drivercCstj|d�S)N)r)r�generate_fallback_config)r	rr
r
rr/sz#Networking.generate_fallback_configcCstj�S)N)r�get_devicelist)r	r
r
rr2szNetworking.get_devicelistcCstj�S)N)r�get_ib_hwaddrs_by_interface)r	r
r
rr5sz&Networking.get_ib_hwaddrs_by_interface)r�ethernet_formatcCstj||�S)N)r�get_ib_interface_hwaddr)r	rrr
r
rr8sz"Networking.get_ib_interface_hwaddrcCs
tj|�S)N)r�get_interface_mac)r	rr
r
rr=szNetworking.get_interface_maccCstj�S)N)r�get_interfaces)r	r
r
rr@szNetworking.get_interfacescCstj�S)N)r�get_interfaces_by_mac)r	r
r
rrCsz Networking.get_interfaces_by_maccCs
tj|�S)N)r�
get_master)r	rr
r
rrFszNetworking.get_master)�strict)rr rcCstj||d�S)N)r )r�interface_has_own_mac)r	rr r
r
rr!Isz Networking.interface_has_own_mac)rrcCs
tj|�S)N)r�is_bond)r	rr
r
rr"NszNetworking.is_bondcCs
tj|�S)N)r�	is_bridge)r	rr
r
rr#QszNetworking.is_bridgecCsdS)z�
        Is ``devname`` a physical network device?

        Examples of non-physical network devices: bonds, bridges, tunnels,
        loopback devices.
        Nr
)r	rr
r
r�is_physicalTszNetworking.is_physicalcCs
tj|�S)N)r�
is_renamed)r	rr
r
rr%]szNetworking.is_renamedcCs
tj|�S)N)r�is_up)r	rr
r
rr&`szNetworking.is_upcCs
tj|�S)N)r�is_vlan)r	rr
r
rr'cszNetworking.is_vlancCs
tj|�S)N)r�master_is_bridge_or_bond)r	rr
r
rr(fsz#Networking.master_is_bridge_or_bond)�existscCsdS)a�Wait for device population in the system to complete.

        :param exists:
            An optional optimisation.  If given, only perform as much of the
            settle process as is required for the given DeviceName to be
            present in the system.  (This may include skipping the settle
            process entirely, if the device already exists.)
        :type exists: Optional[DeviceName]
        Nr
)r	r)r
r
r�settleiszNetworking.settleT)rr rcCs�|j|�}tdd�|D��}t|j��}|j�j�}x�tdd�D]x}|j|�r\tjd�dS|j	|�}tjd|�x8|D]0}	||	}
dj
|
�}tjtj||j
d	|
id
�qxW|j�j�}q@Wd|}tj|�|r�t|��dS)a�Wait for all the physical devices in `netcfg` to exist on the system

        Specifically, this will call `self.settle` 5 times, and check after
        each one if the physical devices are now present in the system.

        :param netcfg:
            The NetworkConfig from which to extract physical devices to wait
            for.
        :param strict:
            Raise a `RuntimeError` if any physical devices are not present
            after waiting.
        cSsg|]}|d|df�qS)r�r
)�.0Zifacer
r
r�
<listcomp>�sz0Networking.wait_for_physdevs.<locals>.<listcomp>r�z*net: all expected physical devices presentNz)net: waiting for expected net devices: %szWaiting for settle or {} existsr))�func�kwargsz-Not all expected physical devices present: %s)r�dict�set�keysr�range�issubset�LOG�debug�
difference�formatrZlog_timer*Zwarning�RuntimeError)r	rr ZphysdevsZexpected_ifacesZ
expected_macsZpresent_macs�_ZmissingZmacr�msgr
r
r�wait_for_physdevsus.






zNetworking.wait_for_physdevscCsdS)z=Try setting the link to up explicitly and return if it is up.Nr
)r	rr
r
r�try_set_link_up�szNetworking.try_set_link_up)%�__name__�
__module__�__qualname__�__doc__r1r�listr�abc�abstractmethod�
NetworkConfigr�
DeviceNamerrrr�boolrrrrrrrrr!r"r#r$r%r&r'r(r*r=r>r
r
r
rrsB

4r)�	metaclasscs�eZdZdZ�fdd�Zdd�Zedd�dd	�Zee	d
�dd�Z
ee	d
�d
d�Zee	d
�dd�Zee	d
�dd�Z
ee	d
�dd�Zdd�dd�dd�Zee	d
�dd�Z�ZS)�
BSDNetworkingz>Implementation of networking functionality shared across BSDs.cs&tj�|_i|_|j�t�j�dS)N)rZIfconfig�ifc�ifs�_update_ifs�super�__init__)r	)�	__class__r
rrO�s
zBSDNetworking.__init__cCs,tjddg�}|dr(|jj|d�|_dS)Nrz-ar)rrK�parserL)r	Zifconfr
r
rrM�szBSDNetworking._update_ifsN)rrcCstjd�dS)Nz Cannot rename network interface.)r6r7)r	rr
r
rr�sz(BSDNetworking.apply_network_config_names)rrcCs|j|jS)N)rLr$)r	rr
r
rr$�szBSDNetworking.is_physicalcCs|j|jS)N)rLr")r	rr
r
rr"�szBSDNetworking.is_bondcCs|j|jS)N)rLr#)r	rr
r
rr#�szBSDNetworking.is_bridgecCs|j|jS)N)rLr')r	rr
r
rr'�szBSDNetworking.is_vlancCs|j|jS)N)rL�up)r	rr
r
rr&�szBSDNetworking.is_up)r))rcCsdS)z0BSD has no equivalent to `udevadm settle`; noop.Nr
)r	r)r
r
rr*�szBSDNetworking.settlecCstjd|dg�|j|�S)z�Try setting the link to up explicitly and return if it is up.
        Not guaranteed to bring the interface up. The caller is expected to
        add wait times before retrying.rrR)rr&)r	rr
r
rr>�szBSDNetworking.try_set_link_up)r?r@rArBrOrMrFrrGrHr$r"r#r'r&r*r>�
__classcell__r
r
)rPrrJ�srJc@s,eZdZedd�dd�Zeed�dd�ZdS)�FreeBSDNetworkingN)rrcCsdS)Nr
)r	rr
r
rr�sz,FreeBSDNetworking.apply_network_config_names)rrcCsB|j|jsdStjdd|gddgd�\}}|dj|�kr>dSdS)	NFZdevinfoz-prr+)�rcszdevinfo: {}: Not found
T)rLr$rr9)r	rr;�errr
r
rr%�szFreeBSDNetworking.is_renamed)r?r@rArFrrGrHr%r
r
r
rrT�srTc@s�eZdZdZedd�dd�Zeed�dd�Zee	d�d	d
�Z
ee	d�dd�Zee	d�d
d�Zee	d�dd�Z
ee	d�dd�Zee	d�dd�Zdd�dd�dd�Zee	d�dd�ZdS)�LinuxNetworkingzCImplementation of networking functionality common to Linux distros.N)rrcCsJy|j|j|��Wn0tk
rD}ztd|�|�WYdd}~XnXdS)z�Read the network config and rename devices accordingly.

        Renames are only attempted for interfaces of type 'physical'. It is
        expected that the network system will create other devices with the
        correct name in place.
        z(Failed to apply network config names: %sN)rrr:)r	r�er
r
rrsz*LinuxNetworking.apply_network_config_names)rrcCs
tj|�S)N)r�get_dev_features)r	rr
r
rrYsz LinuxNetworking.get_dev_featurescCs
tj|�S)N)r�has_netfail_standby_feature)r	rr
r
rrZsz+LinuxNetworking.has_netfail_standby_featurecCs
tj|�S)N)r�is_netfailover)r	rr
r
rr[szLinuxNetworking.is_netfailovercCs
tj|�S)N)r�is_netfail_master)r	rr
r
rr\sz!LinuxNetworking.is_netfail_mastercCs
tj|�S)N)r�is_netfail_primary)r	rr
r
rr]sz"LinuxNetworking.is_netfail_primarycCs
tj|�S)N)r�is_netfail_standby)r	rr
r
rr^sz"LinuxNetworking.is_netfail_standbycCstjjtj|d��S)NZdevice)�os�pathr)r�sys_dev_path)r	rr
r
rr$"szLinuxNetworking.is_physical)r))rcCs"|dk	rtj|�}tj|d�dS)N)r))rrarZudevadm_settle)r	r)r
r
rr*%s
zLinuxNetworking.settlecCstjddd|dg�|j|�S)z�Try setting the link to up explicitly and return if it is up.
        Not guaranteed to bring the interface up. The caller is expected to
        add wait times before retrying.Zip�linkr2rR)rr&)r	rr
r
rr>*szLinuxNetworking.try_set_link_up)r?r@rArBrFrrG�strrYrHrZr[r\r]r^r$r*r>r
r
r
rrW�srW)rDZloggingr_Z	cloudinitrrrZcloudinit.distros.parsersrZ	getLoggerr?r6rcrGr1rF�ABCMetarrJrTrWr
r
r
r�<module>s
 -!

Filemanager

Name Type Size Permission Actions
OpenCloudOS.cpython-36.opt-1.pyc File 542 B 0644
OpenCloudOS.cpython-36.pyc File 542 B 0644
TencentOS.cpython-36.opt-1.pyc File 540 B 0644
TencentOS.cpython-36.pyc File 540 B 0644
__init__.cpython-36.opt-1.pyc File 35.6 KB 0644
__init__.cpython-36.pyc File 35.6 KB 0644
almalinux.cpython-36.opt-1.pyc File 313 B 0644
almalinux.cpython-36.pyc File 313 B 0644
alpine.cpython-36.opt-1.pyc File 6.78 KB 0644
alpine.cpython-36.pyc File 6.78 KB 0644
amazon.cpython-36.opt-1.pyc File 450 B 0644
amazon.cpython-36.pyc File 450 B 0644
arch.cpython-36.opt-1.pyc File 7.33 KB 0644
arch.cpython-36.pyc File 7.33 KB 0644
bsd.cpython-36.opt-1.pyc File 4.87 KB 0644
bsd.cpython-36.pyc File 4.87 KB 0644
bsd_utils.cpython-36.opt-1.pyc File 1.09 KB 0644
bsd_utils.cpython-36.pyc File 1.09 KB 0644
centos.cpython-36.opt-1.pyc File 310 B 0644
centos.cpython-36.pyc File 310 B 0644
cloudlinux.cpython-36.opt-1.pyc File 314 B 0644
cloudlinux.cpython-36.pyc File 314 B 0644
cos.cpython-36.opt-1.pyc File 309 B 0644
cos.cpython-36.pyc File 309 B 0644
debian.cpython-36.opt-1.pyc File 7.52 KB 0644
debian.cpython-36.pyc File 7.52 KB 0644
dragonflybsd.cpython-36.opt-1.pyc File 361 B 0644
dragonflybsd.cpython-36.pyc File 361 B 0644
eurolinux.cpython-36.opt-1.pyc File 313 B 0644
eurolinux.cpython-36.pyc File 313 B 0644
fedora.cpython-36.opt-1.pyc File 310 B 0644
fedora.cpython-36.pyc File 310 B 0644
freebsd.cpython-36.opt-1.pyc File 6.21 KB 0644
freebsd.cpython-36.pyc File 6.21 KB 0644
gentoo.cpython-36.opt-1.pyc File 6.91 KB 0644
gentoo.cpython-36.pyc File 6.91 KB 0644
mariner.cpython-36.opt-1.pyc File 1.54 KB 0644
mariner.cpython-36.pyc File 1.54 KB 0644
miraclelinux.cpython-36.opt-1.pyc File 316 B 0644
miraclelinux.cpython-36.pyc File 316 B 0644
net_util.cpython-36.opt-1.pyc File 1.84 KB 0644
net_util.cpython-36.pyc File 1.84 KB 0644
netbsd.cpython-36.opt-1.pyc File 4.58 KB 0644
netbsd.cpython-36.pyc File 4.58 KB 0644
networking.cpython-36.opt-1.pyc File 12.21 KB 0644
networking.cpython-36.pyc File 12.21 KB 0644
openbsd.cpython-36.opt-1.pyc File 2.26 KB 0644
openbsd.cpython-36.pyc File 2.26 KB 0644
openeuler.cpython-36.opt-1.pyc File 538 B 0644
openeuler.cpython-36.pyc File 538 B 0644
openmandriva.cpython-36.opt-1.pyc File 318 B 0644
openmandriva.cpython-36.pyc File 318 B 0644
opensuse-leap.cpython-36.opt-1.pyc File 321 B 0644
opensuse-leap.cpython-36.pyc File 321 B 0644
opensuse-microos.cpython-36.opt-1.pyc File 324 B 0644
opensuse-microos.cpython-36.pyc File 324 B 0644
opensuse-tumbleweed.cpython-36.opt-1.pyc File 327 B 0644
opensuse-tumbleweed.cpython-36.pyc File 327 B 0644
opensuse.cpython-36.opt-1.pyc File 6.28 KB 0644
opensuse.cpython-36.pyc File 6.28 KB 0644
photon.cpython-36.opt-1.pyc File 4.31 KB 0644
photon.cpython-36.pyc File 4.31 KB 0644
rhel.cpython-36.opt-1.pyc File 4.82 KB 0644
rhel.cpython-36.pyc File 4.82 KB 0644
rhel_util.cpython-36.opt-1.pyc File 969 B 0644
rhel_util.cpython-36.pyc File 969 B 0644
rocky.cpython-36.opt-1.pyc File 309 B 0644
rocky.cpython-36.pyc File 309 B 0644
sle-micro.cpython-36.opt-1.pyc File 317 B 0644
sle-micro.cpython-36.pyc File 317 B 0644
sle_hpc.cpython-36.opt-1.pyc File 315 B 0644
sle_hpc.cpython-36.pyc File 315 B 0644
sles.cpython-36.opt-1.pyc File 312 B 0644
sles.cpython-36.pyc File 312 B 0644
suse.cpython-36.opt-1.pyc File 312 B 0644
suse.cpython-36.pyc File 312 B 0644
ubuntu.cpython-36.opt-1.pyc File 1.45 KB 0644
ubuntu.cpython-36.pyc File 1.45 KB 0644
ug_util.cpython-36.opt-1.pyc File 3.91 KB 0644
ug_util.cpython-36.pyc File 3.91 KB 0644
virtuozzo.cpython-36.opt-1.pyc File 313 B 0644
virtuozzo.cpython-36.pyc File 313 B 0644