Viewing File: /usr/lib/python2.7/site-packages/cloudinit/net/cmdline.pyo
ó
oBú]c @ s& d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l m Z d d l m
Z
d d l m Z d Z e j
e j ƒ d e f d „ ƒ Yƒ Z d e f d
„ ƒ YZ e g Z d d „ Z d „ Z d d d
„ Z d „ Z e d „ Z d d „ Z d d „ Z d S( iÿÿÿÿN( t utili ( t get_devicelist( t read_sys_net_safes# /run/initramfs/open-iscsi.interfacet InitramfsNetworkConfigSourcec B s2 e Z d Z e j d „ ƒ Z e j d „ ƒ Z RS( sB ABC for net config sources that read config written by initramfsesc C s d S( sA Is this initramfs config source applicable to the current system?N( ( t self( ( s9 /usr/lib/python2.7/site-packages/cloudinit/net/cmdline.pyt
is_applicable s c C s d S( s; Render a v1 network config from the initramfs configurationN( ( R ( ( s9 /usr/lib/python2.7/site-packages/cloudinit/net/cmdline.pyt
render_config# s ( t __name__t
__module__t __doc__t abct abstractmethodR R ( ( ( s9 /usr/lib/python2.7/site-packages/cloudinit/net/cmdline.pyR s t KlibcNetworkConfigSourcec B s2 e Z d Z d d d d „ Z d „ Z d „ Z RS( sñ InitramfsNetworkConfigSource for klibc initramfs (i.e. Debian/Ubuntu)
Has three parameters, but they are intended to make testing simpler, _not_
for use in production code. (This is indicated by the prepended
underscores.)
c C s² | | _ | | _ | | _ | j d k r9 t ƒ | _ n | j d k rZ t j ƒ | _ n | j d k r® i | _ x9 t ƒ D]+ } t | d ƒ } | r| | | j | <q| q| Wn d S( Nt address( t _filest
_mac_addrst _cmdlinet Nonet _get_klibc_net_cfg_filesR t get_cmdlineR R ( R R R R t kt mac_addr( ( s9 /usr/lib/python2.7/site-packages/cloudinit/net/cmdline.pyt __init__2 s c C sH | j rD d | j k s' d | j k r+ t St j j t ƒ rD t Sn t S( sD
Return whether this system has klibc initramfs network config or not
Will return True if:
(a) klibc files exist in /run, AND
(b) either:
(i) ip= or ip6= are on the kernel cmdline, OR
(ii) an open-iscsi interface file is present in the system
s ip=s ip6=( R R t Truet ost patht existst _OPEN_ISCSI_INTERFACE_FILEt False( R ( ( s9 /usr/lib/python2.7/site-packages/cloudinit/net/cmdline.pyR D s c C s t d | j d | j ƒ S( Nt filest mac_addrs( t config_from_klibc_net_cfgR R ( R ( ( s9 /usr/lib/python2.7/site-packages/cloudinit/net/cmdline.pyR W s N( R R R R R R R ( ( ( s9 /usr/lib/python2.7/site-packages/cloudinit/net/cmdline.pyR * s c C s„ | d k r i } n t j | ƒ } y$ d | k r= | d n | d } Wn t k
rg t d ƒ ‚ n X| j d | j d ƒ ƒ } | sª | j d ƒ r¡ d } qª d } n | d! k rÉ t d
| ƒ ‚ n i d d 6| d
6g d 6} | | k r| | | d <n xvd"