/usr/lib/python3.6/site-packages/cloudinit/net/__pycache__
NameSizeModeActions
activators.cpython-36.opt-1.pyc97450644editdlrm
activators.cpython-36.pyc97450644editdlrm
bsd.cpython-36.opt-1.pyc58810644editdlrm
bsd.cpython-36.pyc58810644editdlrm
cmdline.cpython-36.opt-1.pyc73750644editdlrm
cmdline.cpython-36.pyc73750644editdlrm
dhcp.cpython-36.opt-1.pyc163640644editdlrm
dhcp.cpython-36.pyc163640644editdlrm
eni.cpython-36.opt-1.pyc131950644editdlrm
eni.cpython-36.pyc131950644editdlrm
ephemeral.cpython-36.opt-1.pyc107620644editdlrm
ephemeral.cpython-36.pyc107620644editdlrm
freebsd.cpython-36.opt-1.pyc26040644editdlrm
freebsd.cpython-36.pyc26040644editdlrm
netbsd.cpython-36.opt-1.pyc17350644editdlrm
netbsd.cpython-36.pyc17350644editdlrm
netplan.cpython-36.opt-1.pyc121960644editdlrm
netplan.cpython-36.pyc121960644editdlrm
networkd.cpython-36.opt-1.pyc84100644editdlrm
networkd.cpython-36.pyc84100644editdlrm
network_manager.cpython-36.opt-1.pyc131390644editdlrm
network_manager.cpython-36.pyc131390644editdlrm
network_state.cpython-36.opt-1.pyc282310644editdlrm
network_state.cpython-36.pyc282310644editdlrm
openbsd.cpython-36.opt-1.pyc22290644editdlrm
openbsd.cpython-36.pyc22290644editdlrm
renderer.cpython-36.opt-1.pyc18630644editdlrm
renderer.cpython-36.pyc18630644editdlrm
renderers.cpython-36.opt-1.pyc15700644editdlrm
renderers.cpython-36.pyc15700644editdlrm
sysconfig.cpython-36.opt-1.pyc236230644editdlrm
sysconfig.cpython-36.pyc236230644editdlrm
udev.cpython-36.opt-1.pyc12500644editdlrm
udev.cpython-36.pyc13400644editdlrm
__init__.cpython-36.opt-1.pyc342300644editdlrm
__init__.cpython-36.pyc342300644editdlrm
Edit: /usr/lib/python3.6/site-packages/cloudinit/net/__pycache__/cmdline.cpython-36.pyc (7375B)
3 \me-$@sddlZddlZddlZddlZddlZddlZddlZddlZddlm Z ddl m Z m Z dZ dZejeZGdddejdZGd d d eZegZdd d Zd dZdddZddZddZddZdddZdS)N)util)get_devicelistread_sys_net_safez#/run/initramfs/open-iscsi.interfacedisabledc@s8eZdZdZejedddZejedddZ dS)InitramfsNetworkConfigSourcezBABC for net config sources that read config written by initramfses)returncCsdS)zAIs this initramfs config source applicable to the current system?N)selfrr/usr/lib/python3.6/cmdline.py is_applicablesz*InitramfsNetworkConfigSource.is_applicablecCsdS)z;Render a v1 network config from the initramfs configurationNr)r rrr render_config"sz*InitramfsNetworkConfigSource.render_configN) __name__ __module__ __qualname____doc__abcabstractmethodboolr dictr rrrr rs r) metaclassc@s6eZdZdZd ddZedddZeddd ZdS) KlibcNetworkConfigSourcezInitramfsNetworkConfigSource 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.) NcCst||_||_||_|jdkr$t|_|jdkr8tj|_|jdkrpi|_x&tD]}t|d}|rP||j|<qPWdS)Naddress)_files _mac_addrs_cmdline_get_klibc_net_cfg_filesr get_cmdlinerr)r rrrkZmac_addrrrr __init__/s      z!KlibcNetworkConfigSource.__init__)rcCs>|jr:x"tj|jD]}|jdrdSqWtjjtr:dSdS)aD 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 ip=ip6=TF)rr ) rshlexsplitr startswithospathexists_OPEN_ISCSI_INTERFACE_FILE)r itemrrr r As   z&KlibcNetworkConfigSource.is_applicablecCst|j|jdS)N)files mac_addrs)config_from_klibc_net_cfgrr)r rrr r Tsz&KlibcNetworkConfigSource.render_config)NNN) r rrrrrr rr rrrr r's rcCs|dkr i}tj|}yd|kr(|dn|d}Wn,tk r^}ztd|WYdd}~XnX|jd|jd}|s|jdrd}nd }|d!krtd |d |gd }||kr|||d<x,d"D]"}|d|krq|j|d|}|d krd}|dd} |dkr||d| d<x0d#D](} || |kr"||| | | j<q"Wg} xDd$D]<} |j|| } | rXt| jdrX| j||| qXW| r| | d<|jd}|rd|kr|j d| d<n |j | d<|d j| qW||fS)%aConvert a klibc written shell content file to a 'config' entry When ip= is seen on the kernel command line in debian initramfs and networking is brought up, ipconfig will populate /run/net-.cfg. The files are shell style syntax, and examples are in the tests provided here. There is no good documentation on this unfortunately. DEVICE= is expected/required and PROTO should indicate if this is 'none' (static) or 'dhcp' or 'dhcp6' (LP: #1621507). note that IPV6PROTO is also written by newer code to address the possibility of both ipv4 and ipv6 getting addresses. Full syntax is documented at: https://git.kernel.org/pub/scm/libs/klibc/klibc.git/plain/usr/kinit/ipconfig/README.ipconfig NZDEVICEZDEVICE6z&no 'DEVICE' or 'DEVICE6' entry in dataZPROTOZ IPV6PROTOfilenamedhcpnonedhcp6zUnexpected value for PROTO: %sZphysical)typenamesubnets mac_addressIPV4IPV6ZADDRZstaticZmanual)r0ZcontrolrNETMASK BROADCASTGATEWAYDNS0DNS1z:.0Zdns_nameserversZ DOMAINSEARCH,Z dns_searchr2)r.r-r/)r4r5)r6r7r8)r9r:) rZload_shell_contentKeyError ValueErrorgetlowerlenstripappendr")Zcontentr*datar1eprotoZifaceZpreZ cur_protoZsubnetkeyZdnsZnskeynssearchrrr _klibc_to_config_entry^sZ             rIcCstjdtjdS)Nz/run/net-*.confz/run/net6-*.conf)globrrrr rsrcCs|dkrt}g}i}x|D]}ttj||d\}}||kr||d}|jd|jdkrtdj|dj||d|jd|jdd|dj|d||dj |q|g|d ||<|j |qW|d d S) N)r*entryr3zedevice '{name}' was defined multiple times ({files}) but had differing mac addresses: {old} -> {new}. r))r1r)oldnewr2)r)rK)configversion) rrIrZ load_filer>r=formatjoinextendrB)r)r*ZentriesnamesZcfg_filer1rKprevrrr r+s*  r+cCs(x"tD]}|}|jsq|jSWdS)a Return v1 network config for initramfs-configured networking (or None) This will consider each _INITRAMFS_CONFIG_SOURCES entry in turn, and return v1 network configuration for the first one that is applicable. If none are applicable, return None. N)_INITRAMFS_CONFIG_SOURCESr r )Zsrc_clsZ cfg_sourcerrr read_initramfs_configs   rXcCs^tj|J}d}z0ytjd|d}|jStk r<|SXWd|rN|jXWdQRXdS)Nrb)modeZfileobj)ioBytesIOgzipZGzipFilereadIOErrorclose)blobZiobufZgzfprrr _decomp_gzips  rbc Cs<ytj|}Wn$ttfk r2tjd|dSXt|S)zDecode a string base64 encoding, if gzipped, uncompress as well :return: decompressed unencoded string of the data or empty string on unencoded data. z`Expected base64 encoded kernel commandline parameter network-config. Ignoring network-config=%s.)base64Z b64decode TypeErrorr=LOGerrorrb)rCrarrr _b64dgzsrhcCsn|dkrtj}d|krjd}x*|jD]}|jdr&|jddd}q&W|rj|tkr\ddiStjt|SdS)Nznetwork-config==rOrPr)rrr"r#&KERNEL_CMDLINE_NETWORK_CONFIG_DISABLEDZ load_yamlrh)ZcmdlineZdata64tokrrr read_kernel_cmdline_configs rl)N)NN)N)rrdrJr]r[Zloggingr$r!Z cloudinitrZ cloudinit.netrrr'rjZ getLoggerr rfABCMetarrrWrIrr+rXrbrhrlrrrr s,   4 ]