/usr/lib/python3.6/site-packages/cloudinit/net/__pycache__
Edit: /usr/lib/python3.6/site-packages/cloudinit/net/__pycache__/ephemeral.cpython-36.pyc (10762B)
3
\meS9 @ s d Z ddlZddlZddlmZ ddlmZmZmZm Z m
Z
ddljZddl
mZmZmZ ddlmZ ejeZG dd dZG d d
d
ZG dd dZG d
d dZdS )z.Module for ephemeral network context managers
N)partial)AnyCallableDictListOptional)IscDhclientNoDHCPLeaseErrormaybe_perform_dhcp_discovery)ProcessExecutionErrorc @ sT e Zd ZdZdeeeef dddZdd Z dd Z
d
d Zdd
Zdd Z
dS )EphemeralIPv4Networka Context manager which sets up temporary static network configuration.
No operations are performed if the provided interface already has the
specified configuration.
This can be verified with the connectivity_url_data.
If unconnected, bring up the interface with valid ip, prefix and broadcast.
If router is provided setup a default route for that interface. Upon
context exit, clean up the interface leaving no configuration behind.
N)connectivity_url_datac
C s t ||||gs$tdj||||ytj|| _W n2 tk
rf } ztdj| | W Y dd} ~ X nX || _|| _|| _|| _ || _
|| _g | _|| _
dS )aX Setup context manager and validate call signature.
@param interface: Name of the network interface to bring up.
@param ip: IP address to assign to the interface.
@param prefix_or_mask: Either netmask of the format X.X.X.X or an int
prefix.
@param broadcast: Broadcast address for the IPv4 network.
@param router: Optionally the default gateway IP.
@param connectivity_url_data: Optionally, a URL to verify if a usable
connection already exists.
@param static_routes: Optionally a list of static routes from DHCP
z5Cannot init network on {0} with {1}/{2} and bcast {3}z4Cannot setup network, invalid prefix or netmask: {0}N)all
ValueErrorformatnetZipv4_mask_to_net_prefixprefixr
interfaceip broadcastrouter
static_routescleanup_cmdsdistro)
selfr r r prefix_or_maskr r r
r e r /usr/lib/python3.6/ephemeral.py__init__ s&