File "network_manager.cpython-36.pyc"

Full Path: /home/attunedd/public_html/byp/izo/con7ext_sym404/rintoar.txt/usr/lib/python3.6/site-packages/cloudinit/net/__pycache__/network_manager.cpython-36.pyc
File size: 12.83 KB
MIME-type: text/x-bytecode.python
Charset: 8 bit

3

xh9L@sddlZddlZddlZddlZddlZddlZddlmZmZddl	m
Z
mZddlm
Z
mZmZmZddlmZddlmZdZdZd	Zd
ZdZejeZGdd
d
ZGdddejZdddZdddZ ddZ!dddZ"dddZ#dS)N)ListOptional)subputil)is_ipv6_addressis_ipv6_networkrenderersubnet_is_ipv6)NetworkState)available_nm_ifcfg_rhz/etc/NetworkManagerz/usr/lib/NetworkManagerz'/etc/NetworkManager/NetworkManager.confz/etc/sysconfig/network-scriptsz# This is generated by cloud-init. Do not edit.
#
[.config]
  enable=nm-version-min:1.40
[connection.30-cloud-init-ip6-addr-gen-mode]
  # Select EUI64 to be used if the profile does not specify it.
  ipv6.addr-gen-mode=0

c@seZdZdZddZddZddZdd	Zd
dZdd
Z	ddZ
ddZddZddZ
eddddZeeddddZddZdd Zed!d"Zd#d$Zd%d&ZdS)'NMConnectionz/Represents a NetworkManager connection profile.cCsRtjd}tj|_t|j_d|ttj||dd|jd<ddi|jd<d	S)
z
        Initializes the connection with some very basic properties,
        notably the UUID so that the connection can be referred to.
        z$a3924cb8-09e0-43e9-890b-77972a800108zcloud-init Z120)iduuidzautoconnect-priority
connectionz%org.freedesktop.NetworkManager.originz
cloud-inituserN)rZUUIDconfigparserZConfigParserconfigstrZoptionxformZuuid5)selfcon_idZ
CI_NM_UUIDr%/usr/lib/python3.6/network_manager.py__init__.s

zNMConnection.__init__cCs6|jj|si|j|<|jj||s2||j||<dS)z_
        Sets a property unless it's already set, ensuring the section
        exists.
        N)rhas_section
has_option)rsectionoptionvaluerrr_set_defaultFs
zNMConnection._set_defaultcCs|jj|o|jj||S)zf
        Checks if a config option is set. Returns True if it is,
        else returns False.
        )rrr)rrrrrr_config_option_is_setQsz"NMConnection._config_option_is_setcCs"|j||r|j||SdSdS)z]
        Returns the value of a config option if its set,
        else returns None.
        N)rr)rrrrrr_get_config_optionZszNMConnection._get_config_optioncCs|j||r||j||<dS)z
        Overrides the value of a config option if its already set.
        Else, if the config option is not set, it does nothing.
        N)rr)rrrrrrr_change_set_config_optiondsz&NMConnection._change_set_config_optioncCsVx4d
D],}|j|ddkrdS|j|ddkrdSqWxdD]}|j|dd	q<WdS)
zt
        If for both ipv4 and ipv6, 'may-fail' is set to be False,
        set it to True for both of them.
        ipv4ipv6zmay-failfalseNmethoddhcpautotrue)r"r#)r&r')r"r#)r r!)rfamilyrrr$_set_mayfail_true_if_both_false_dhcpls


z1NMConnection._set_mayfail_true_if_both_false_dhcpcCsddddddddd}|j|ddy||}Wn&tk
rVd}d|j|d<YnX|j|ddkrnd	S|j|ddkr|dkrd	S|dkr|jd
dd||j|d<|j|ddd	S)z}
        Ensures there's appropriate [ipv4]/[ipv6] for given family
        appropriate for given configuration type
        Zmanualr'r&)ZstaticZstatic6Zdhcp6
ipv6_slaaczipv6_dhcpv6-statelesszipv6_dhcpv6-statefulZdhcp4r&r%Zdisabledr(zmay-failNipv6_dhcpv6-statefulipv6_dhcpv6-statelessr+r"r$)r,r-r+)rKeyErrorr)rr)Zsubnet_typeZ
method_mapr%rrr_set_ip_methods2zNMConnection._set_ip_methodcCsX|jj|si|j|<x<tjdD].}||}|jj||s"||j||<Pq"WdS)z
        Adds a numbered property, such as address<n> or route<n>, ensuring
        the appropriate value gets used for <n>.
        N)rr	itertoolscountr)rrZ
key_prefixrindexkeyrrr
_add_numbereds
zNMConnection._add_numberedcCs*|ddt|d}|j|d|dS)z5
        Adds an ipv[46]address<n> property.
        address/prefixN)rr5)rr)subnetrrrr_add_addressszNMConnection._add_addresscCsVt|drdnd}|ddt|d}d|krD|d|d}|j|d|d	S)
z!Adds a ipv[46].route<n> property.gatewayr#r"Znetworkr7r8,routeN)rrr5)rr=r)rrrr
_add_routes
zNMConnection._add_routeN)dnsreturncCsNt|rdnd}|jj|rJ|j|dd|j|d|d|j|d<dS)zF
        Extends the ipv[46].dns property with a name server.
        r#r"r?;N)rrrr)rr?r)rrr_add_nameserverszNMConnection._add_nameserver)
dns_searchr@cCsRxLdD]D}|jj|r|j|dd|j|ddj|d|j|d<qWdS)zM
        Extends the ipv[46].dns-search property with a name server.
        r"r#z
dns-searchrArBN)r"r#)rrrjoin)rrDr)rrr_add_dns_searchs
zNMConnection._add_dns_searchcCs|jddS)z-
        Returns the connection UUID
        rr)r)rrrrcon_uuidszNMConnection.con_uuidcCs|jjddS)zN
        Can this be serialized into a meaningful connection profile?
        rtype)rr)rrrrvalidszNMConnection.validcCs|jddjS)z)
        Sanitize a MAC address.
        -:)replaceupper)Zaddrrrrmac_addrszNMConnection.mac_addrc
stddddddd}||d}|dkr*dSd	|kr8d}nd}||jd
d<|dk	r|||jd
d<|j||d|jd
d
<i|j|<dddddddddd	dddddiiid}|d}d}	ggx|dD]}
t|
rd nd!}|j||
dd"|
kr|j||
d#|
kr(|
d#|j|d#<x|
d$D]}|j|q2Wd%|
kr^j|
d%d&|
krvj|
d&|d!krd|
kr|
d}	qWd'|kr؈fd(d)|d'd*D7fd+d)|d'd,D7r|jr|jr|jr|jxD]}
|j	|
q
Wr.|j
|j|	dkrD|}	|	|ksbtj
d-|d.||	x~||jD]n\}}||krqp||dkrqpt||tr||rd/nd0|j||<nt|||j||<qpW|dkrN|d1d2krtd3|jdd4<|	dk	r(t|	|jdd<|d5dk	rN|j|d5|jdd6<|dkrzd7|krz|j|d7|jdd8<|dkrx<|d9D]0}|j|}|jd
dd|jd
d
|jqW|d5dk	r|j|d5|jdd6<|dkrB|	dk	rBd:|jdd;<t|	|jdd<|d5dk	rB|j|d5|jdd6<|dks^|jj|d6rp|d.|jd
d<<dS)=z
        Integrate information from network state interface information
        into the connection. Most of the work is done here.
        ethernetvlanbondbridge
infinibandN)ZphysicalrPrQrRrSZloopbackrHzbond-masterrz
slave-typez-masterZmasterz	bond-modeZbond_miimonzbond-xmit-hash-policyzbond-num-grat-arpzbond-downdelayzbond-updelayzbond-fail-over-maczbond-primary-reselectzbond-primary)	modeZmiimonZxmit_hash_policyZnum_grat_arpZ	downdelayZupdelayZ
fail_over_macZprimary_reselectZprimaryZ
bridge_stpZbridge_bridgeprio)ZstpZpriorityr
Zvlan_id)rQrRrPrOrSZmtuZsubnetsr#r"r6r;Zroutesdns_nameserversrDr?csg|]}|kr|qSrr).0r?)found_nameserversrr
<listcomp>Osz1NMConnection.render_interface.<locals>.<listcomp>Znameserverscsg|]}|kr|qSrr)rVsearch)found_dns_searchrrrXTsrYzZNetwork config: ignoring %s device-level mtu:%s because ipv4 subnet-level mtu:%s provided.namer(r$Z	wakeonlanT@zwake-on-lanZmac_addresszmac-addresszvlan-raw-deviceparentZbridge_portsZdatagramztransport-modezinterface-name)rcon_refr	r/r:r>extendrUZdns_searchdomainsrCrFr*LOGZwarningitems
isinstanceboolrrNget_connrrGr)riface
network_staterZ	_type_mapZif_typeZ
slave_typeZ	_prop_mapZ
device_mtuZipv4_mtur9r)r=Z
nameserverZnm_propr4Zportr)rZrWrrender_interfaces
















zNMConnection.render_interfacecCs(tj}|jj|ddd}||jS)z
        Stringify.
        F)Zspace_around_delimitersz2# Generated by cloud-init. Changes will be lost.

)ioStringIOrwritegetvalue)rZbufheaderrrrdumpszNMConnection.dump)__name__
__module____qualname____doc__rrrr r!r*r/r5r:r>rrCrrFrGrIstaticmethodrNrgrmrrrrr+s&	
-

	
5rc@sBeZdZdZdddZddZddZd
eee	dd	d
dZ
dS)Rendererz?Renders network information in a NetworkManager keyfile format.NcCsi|_||_dS)N)connectionsr)rrrrrrszRenderer.__init__cCs
|j|S)N)rt)rrrrrrdszRenderer.get_conncCs ||jkr|j|jS|SdS)N)rtrG)rrrrrr^s
zRenderer.con_ref)rf	templatesr@cCsx&|jD]}t|d|j|d<q
Wx,|jD] }|j|d}|j|||q2Wx<|jjD].\}}|jstqbt||}tj||j	dqbWtjt
|tddS)Nr[i)Ziter_interfacesrrtrgrarInm_conn_filenamerZ
write_filermcloud_init_nm_conf_filenameNM_IPV6_ADDR_GEN_CONF)rrfrutargetreZconnrr[rrrrender_network_states	
zRenderer.render_network_state)N)NN)rnrorprqrrdr^r
rdictrzrrrrrss


rscCs&tj|t}d|d}|d|S)Nzcloud-init-z
.nmconnectionz/system-connections/)rtarget_path
NM_RUN_DIR)rrytarget_con_dircon_filerrrrvsrvcCs$tj|t}d|}|d|S)Nzifcfg-r7)rr|IFCFG_CFG_FILE)devnameryr~rrrrsysconfig_conn_filenames
rcCs8t|}tjj|r$tr$t|}tjj|r4|SdS)a
    This function returns the name of the interface config file.
    It first checks for presence of network manager connection file.
    If absent and ifcfg-rh plugin for network manager is available,
    it returns the name of the ifcfg file if it is present. If the
    plugin is not present or the plugin is present but ifcfg file is
    not, it returns None.
    This function is called from NetworkManagerActivator class in
    activators.py.
    N)rvospathisfilerr)rZ	conn_filerrr
conn_filenamesrcCstj|t}d}|d|S)Nz$30-cloud-init-ip6-addr-gen-mode.confz/conf.d/)rr|r})ryr~Z	conf_filerrrrw	srwcCszddlm}tjjtj|td}tjd|d}d}|rjytjddd	gWntj	k
rhd
}YnX|oxt
|ox|S)Nr)uses_systemd)rZnmcli)ryTZ	systemctlz
is-enabledzNetworkManager.serviceF)Zcloudinit.distrosrrrrrr|NM_CFG_FILEZwhichZProcessExecutionErrorrc)ryrZconfig_presentZ
nmcli_presentZservice_activerrr	availables
r)N)N)N)N)$rrhr1ZloggingrrZtypingrrZ	cloudinitrrZ
cloudinit.netrrrr	Zcloudinit.net.network_stater
Zcloudinit.net.sysconfigrr}Z
NM_LIB_DIRrrrxZ	getLoggerrnr`rrsrvrrrwrrrrr<module>	s4	
0