%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/salt/modules/
Upload File :
Create Path :
Current File : //usr/lib/python2.7/site-packages/salt/modules/rh_ip.pyo

�
���^c@@s@dZddlmZmZmZddlZddlZddlZddlZddl	Zddl
ZddlZddl
ZddlZddlmZddlmZeje�Zejdejejjejjjd���ZdZd	�Zd
ddd
ddddddddgZ ddddddddgZ!ddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2gZ"d3Z#d4Z$d5Z%d6d7d8d9e&gZ'd:d;d<d=e(gZ)d>d?d@dAdBdCdDdEdFdGdHgZ*dI�Z+dJ�Z,dK�Z-dL�Z.dM�Z/dN�Z0dO�Z1dP�Z2dQ�Z3dR�Z4dS�Z5dT�Z6dU�Z7dV�Z8dW�Z9dX�Z:dY�Z;dZ�Z<d[�Z=d\�Z>d]�Z?d^�Z@d_�ZAd`�ZBda�ZCdb�ZDdc�ZEdd�ZFde�ZGdf�ZHdg�ZIdh�ZJdi�ZKdj�ZLdk�ZMdl�ZNdm�ZOdS(nu5
The networking module for RHEL/Fedora based distros
i(tabsolute_importtunicode_literalstprint_functionN(tCommandExecutionError(tsixtloaderurh_ipuipcC@stddkrtStdfS(u:
    Confine this module to RHEL/Fedora based distros
    u	os_familyuRedHatunThe rh_ip execution module cannot be loaded: this module is only available on RHEL/Fedora based distributions.(t
__grains__t__virtualname__tFalse(((s6/usr/lib/python2.7/site-packages/salt/modules/rh_ip.pyt__virtual__&suautoneguspeeduduplexurxutxusgutsouufougsougroulrou	advertiseudomainupeerdnsupeerntpudefrouteumtuu
static-routesugatewayuzoneumodeumiimonuarp_intervalu
arp_ip_targetu	downdelayuupdelayuuse_carrieru	lacp_rateuhashing-algorithmu	max_bondsu	tx_queuesunum_grat_arpunum_unsol_nauprimaryuprimary_reselectu	ad_selectuxmit_hash_policyuarp_validateu
fail_over_macuall_slaves_activeuresend_igmpu/etc/sysconfig/network-scriptsu/etc/sysconfig/networku/etc/modprobe.duyesuonutrueu1unouoffufalseu0uethubondualiasucloneuipsecudialupubridgeuslaveuvlanuipipuibcC@s"d}|j||dj|��S(uc
    Build an appropriate error message from a given option and
    a list of expected values.
    u>Invalid option -- Interface: {0}, Option: {1}, Expected: [{2}]u|(tformattjoin(tifacetoptiontexpectedtmsg((s6/usr/lib/python2.7/site-packages/salt/modules/rh_ip.pyt_error_msg_ifaceNscC@sd}|j|||�S(uc
    Build an appropriate error message from a given option and
    a list of expected values.
    uDInvalid option -- Route interface: {0}, Option: {1}, Expected: [{2}](R
(RR
RR((s6/usr/lib/python2.7/site-packages/salt/modules/rh_ip.pyt_error_msg_routesWscC@stjd|||�dS(Nu:Using default option -- Interface: %s Option: %s Value: %s(tlogtinfo(Rtopttvalue((s6/usr/lib/python2.7/site-packages/salt/modules/rh_ip.pyt_log_default_iface`s	cC@sd}|j|dj|��S(uc
    Build an appropriate error message from a given option and
    a list of expected values.
    u8Invalid network setting -- Setting: {0}, Expected: [{1}]u|(R
R(R
RR((s6/usr/lib/python2.7/site-packages/salt/modules/rh_ip.pyt_error_msg_networkescC@stjd||�dS(Nu/Using existing setting -- Setting: %s Value: %s(RR(RR((s6/usr/lib/python2.7/site-packages/salt/modules/rh_ip.pyt_log_default_networkns	cC@s�t|�}i}|r�x�|D]�}|j�}t|�dks|jd�s|jd�rgqng|jdd�D]}|j�^qz}t|�dkr�qn|\}}|||j�<qWn|S(Niu!u#u=ii(t
_read_filetstriptlent
startswithtsplittrstriptupper(tpatht	rh_configtcv_rh_configtlinetptpairtnameR((s6/usr/lib/python2.7/site-packages/salt/modules/rh_ip.pyt_parse_rh_configss
0+cC@sNi}d|krw|dtkr9|jidd6�qw|dtkr`|jidd6�qwt|dtt�nd|kr�ddg}|d|kr�|ji|dd6�q�t|d|�nd|kr6dd	d
dg}tj|d�|kr|ji|dd6�q6t||d|�nd|kr�d
ddddddddddddddddg}tj|d�|kr�|ji|dd6�q�t|d|�ntt}x{d&D]s}||kr�||tkr|jid|6�qF||tkr3|jid|6�qFt|||�q�q�W|S('u�
    Filters given options and outputs valid settings for ETHTOOLS_OPTS
    If an option has a value that is not expected, this
    function will log what the Interface, Setting and what it was
    expecting.
    uautoneguonuoffuduplexufulluhalfuspeedu10u100u1000u10000u	advertiseu0x001u0x002u0x004u0x008u0x010u0x020u0x20000u0x8000u0x1000u0x40000u0x80000u0x200000u0x400000u0x800000u	0x1000000u	0x2000000u	0x4000000urxutxusgutsouufougsougroulro(urxutxusgutsouufougsougroulro(t_CONFIG_TRUEtupdatet
_CONFIG_FALSEt_raise_error_ifaceRt	text_type(toptsRtconfigtvalidR
((s6/usr/lib/python2.7/site-packages/salt/modules/rh_ip.pyt_parse_ethtool_opts�sD

cC@s�i
dd6dd6dd6dd6d	d
6dd6dd
6dd6dd6dd6}|dd'kr|tjd|�t|||�S|dd(kr�tjd|�t|||�S|dd)kr�tjd|�t|||�S|dd*krtjd|�t|||�S|dd+kr<tjd|�t|||�S|dd,krltjd"|�t|||�S|dd-kr�tjd%|�t|||�Sdddddd!d$dddddd d#g}t	|d|�d&S(.u�
    Filters given options and outputs valid settings for requested
    operation. If an option has a value that is not expected, this
    function will log what the Interface, Setting and what it was
    expecting.
    u0u	ad_selectu16u	tx_queuesu100umiimonu250uarp_intervalu200u	downdelayu	lacp_rateu1u	max_bondsuupdelayuuse_carrierulayer2uxmit_hash_policyumodeu
balance-rru5Device: %s Bonding Mode: load balancing (round-robin)u
active-backupu8Device: %s Bonding Mode: fault-tolerance (active-backup)ubalance-xoru2u-Device: %s Bonding Mode: load balancing (xor)u	broadcastu3u4Device: %s Bonding Mode: fault-tolerance (broadcast)u802.3adu4u>Device: %s Bonding Mode: IEEE 802.3ad Dynamic link aggregationubalance-tlbu5u0Device: %s Bonding Mode: transmit load balancingubalance-albu6u0Device: %s Bonding Mode: adaptive load balancingN(u
balance-rru0(u
active-backupu1(ubalance-xoru2(u	broadcastu3(u802.3adu4(ubalance-tlbu5(ubalance-albu6(
RRt_parse_settings_bond_0t_parse_settings_bond_1t_parse_settings_bond_2t_parse_settings_bond_3t_parse_settings_bond_4t_parse_settings_bond_5t_parse_settings_bond_6R+(R-Rtbond_defR/((s6/usr/lib/python2.7/site-packages/salt/modules/rh_ip.pyt_parse_settings_bond�s`


	cC@s�t|||�}|jidd6�dg}d|kr�t|dt�r�dt|d�koodknr�|jidd6�x^|dD]?}t|d�dkr�|dd	||d<q�||d<q�Wq�t|d|�qt|d|�nd
|krt|d|�nd|kr~y*t|d�|ji|dd6�Wq�tk
rzt|ddg�q�Xn,t|d|d�|ji|dd6�|S(
u�
    Filters given options and outputs valid settings for bond0.
    If an option has a value that is not expected, this
    function will log what the Interface, Setting and what it was
    expecting.
    u0umodeulist of ips (up to 16)u
arp_ip_targetiiuiu,umiimonuarp_intervaluinteger(	R2R)t
isinstancetlistRR+tintt	ExceptionR(R-RR8tbondR/tip((s6/usr/lib/python2.7/site-packages/salt/modules/rh_ip.pyR1s0		&
cC@s�idd6}x�dddgD]�}||kr�y*t||�|ji|||6�Wq�tk
rt||dg�q�Xqt||||�|ji|||6�qWd|kr*|dtkr�|jidd6�qV|dtkr
|jidd6�qVtt}t|d|�n,t|d|d�|ji|dd6�d	|kr}|ji|d	d	6�n|S(
u�
    Filters given options and outputs valid settings for bond1.
    If an option has a value that is not expected, this
    function will log what the Interface, Setting and what it was
    expecting.
    u1umodeumiimonu	downdelayuupdelayuintegeruuse_carrieru0uprimary(R<R)R=R+RR(R*(R-RR8R>tbindingR/((s6/usr/lib/python2.7/site-packages/salt/modules/rh_ip.pyR2@s,


cC@s�idd6}dg}d|kr�t|dt�r�dt|d�koVdknr�|jidd6�x^|dD]?}t|d�dkr�|dd	||d<qz||d<qzWq�t|d|�q�t|d|�nt|d|�d
|krVy*t|d
�|ji|d
d
6�Wq�tk
rRt|d
dg�q�Xn,t|d
|d
�|ji|d
d
6�d|kr�d
ddg}|d|kr�|ji|dd6�q�t|d|�n|S(u�
    Filters given options and outputs valid settings for bond2.
    If an option has a value that is not expected, this
    function will log what the Interface, Setting and what it was
    expecting.
    u2umodeulist of ips (up to 16)u
arp_ip_targetiiuiu,uarp_intervaluintegeruhashing-algorithmulayer2ulayer2+3ulayer3+4uxmit_hash_policy(R:R;RR)R+R<R=R(R-RR8R>R/R?((s6/usr/lib/python2.7/site-packages/salt/modules/rh_ip.pyR3gs6
	&
cC@sZidd6}x�dddgD]�}||kr�y*t||�|ji|||6�Wq�tk
rt||dg�q�Xqt||||�|ji|||6�qWd|kr*|dtkr�|jidd6�qV|dtkr
|jid	d6�qVtt}t|d|�n,t|d|d�|ji|dd6�|S(
u�
    Filters given options and outputs valid settings for bond3.
    If an option has a value that is not expected, this
    function will log what the Interface, Setting and what it was
    expecting.
    u3umodeumiimonu	downdelayuupdelayuintegeruuse_carrieru1u0(R<R)R=R+RR(R*(R-RR8R>R@R/((s6/usr/lib/python2.7/site-packages/salt/modules/rh_ip.pyR4�s(


cC@s.idd6}xdddddgD]}||kr�|dkr�||dkrh|jid	|6�n||d
kr�|jid|6�ndd	d
dg}n	dg}y*t||�|ji|||6�Wq*tk
r�t|||�q*Xq#t||||�|ji|||6�q#Wd
|kr�|d
tkra|jid	d
6�q�|d
tkr�|jidd
6�q�tt}t|d
|�n,t|d
|d
�|ji|d
d
6�d|kr*dddg}|d|kr|ji|dd6�q*t|d|�n|S(u�
    Filters given options and outputs valid settings for bond4.
    If an option has a value that is not expected, this
    function will log what the Interface, Setting and what it was
    expecting.
    u4umodeumiimonu	downdelayuupdelayu	lacp_rateu	ad_selectufastu1uslowu0uintegeruuse_carrieruhashing-algorithmulayer2ulayer2+3ulayer3+4uxmit_hash_policy(R)R<R=R+RR(R*(R-RR8R>R@R/((s6/usr/lib/python2.7/site-packages/salt/modules/rh_ip.pyR5�s@
	

cC@s�idd6}x�dddgD]�}||kr�y*t||�|ji|||6�Wq�tk
rt||dg�q�Xqt||||�|ji|||6�qWd|kr*|dtkr�|jidd6�qV|dtkr
|jid	d6�qVtt}t|d|�n,t|d|d�|ji|dd6�d
|kr}|ji|d
d
6�n|S(u�
    Filters given options and outputs valid settings for bond5.
    If an option has a value that is not expected, this
    function will log what the Interface, Setting and what it was
    expecting.
    u5umodeumiimonu	downdelayuupdelayuintegeruuse_carrieru1u0uprimary(R<R)R=R+RR(R*(R-RR8R>R@R/((s6/usr/lib/python2.7/site-packages/salt/modules/rh_ip.pyR6�s,


cC@s�idd6}x�dddgD]�}||kr�y*t||�|ji|||6�Wq�tk
rt||dg�q�Xqt||||�|ji|||6�qWd|kr*|dtkr�|jidd6�qV|dtkr
|jid	d6�qVtt}t|d|�n,t|d|d�|ji|dd6�d
|kr}|ji|d
d
6�n|S(u�
    Filters given options and outputs valid settings for bond6.
    If an option has a value that is not expected, this
    function will log what the Interface, Setting and what it was
    expecting.
    u6umodeumiimonu	downdelayuupdelayuintegeruuse_carrieru1u0uprimary(R<R)R=R+RR(R*(R-RR8R>R@R/((s6/usr/lib/python2.7/site-packages/salt/modules/rh_ip.pyR7s,


cC@s�i}d|kr^|dttkrA|ji|dd6�q^tt}t|d|�nd|kr�|ddkr�|ji|dd6�q�t|dd�nd|kr�t|d�dkr�|ji|dd6�q�t|dd�n|S(uE
    Filters given options and outputs valid settings for a vlan
    ureorder_hdruvlan_idiuPositive integeruphys_devuNon-empty string(R(R*R)R+R(R-RtvlanR/((s6/usr/lib/python2.7/site-packages/salt/modules/rh_ip.pyt_parse_settings_vlan;s
cC@s	i|d6}d|kr`dddg}|d|krI|d|d<q`t||d|�nd|kr�|d|d<d|d<nd	|kr�yt|d	�|d	<Wq�tk
r�t|d	d
g�q�Xn|dRkrt||�}|r||d<qn|d
krd|d<n|dkrZt||�}|rZ||d<d|d<qZn|dkr�t||�}|r�d|d<x|D]}	||	||	<q�Wq�n|dSkr�t}
d|krAtjj	j
j|d�r�|d|d<qG|ddkrt}
qG|ddkrGt||ddddg�qGnt}
|
r�|d
kr�t
d�}||kr�d||kr�||d|d<q�q�q�n|dkr�d|d<n|dkr�d|d<t}tt}xfdgD][}	|	|kr�||	tkrt}qD||	tkr-t}qDt|||	|�q�q�Wddd g}
|rfd!}nd"}xg|
D]?}yt
d#||�Wqstk
r�tjd$|�qsXqsWnd|kr�|d|d<n|dkr:d%|d<xKd&d'gD]:}	|	|kr%t|||	d(g�q�||	||	<q�Wn|d)krSd*|d<nd+|kr�d,|kr�d-}tj|�t|��n|d+|d+<nd,|kr�|d,|d,<nxFd.d/d0d1d2d3d4d5d6g	D]#}	|	|kr�||	||	<q�q�Wx1d7d8gD]#}	|	|kr||	||	<qqWd9|kr�g|d9<x�|d9D]�}	tjj	j
j|	�r�g|	jd:�D]}|j�^q�\}}|d9ji|d.6|d+6�qYd;}tj|�t|��qYWnd<|krYx]|d<D]N}	tjj	j
j|	�sDd=}tj|�t|��n|d<|d<<qWnd>|krv|d>|d><ntt}x�d?dd@d
ddAdBdCdDdEdFdGdHg
D]c}	|	|kr�||	tkr�d||	<q||	tkr�dI||	<qt|||	|�q�q�WdJ|kr7tjdK||�n|rJd|dJ<n
dI|dJ<dL|kr�|dLtkr}d|dL<q�|dLtkr�dI|dL<q�t||dL|�n
dI|dL<d|kr|dtkr�d|d<q|dtkrdI|d<qt||d|�ndM|krD|dMtkrDdI|dM<qDndN|kra|dN|dN<ndO|kr~|dO|dO<ndP|kr�|dP|dP<ndQ|kr�|dQtkr�d|dQ<q	|dQtkr�dI|dQ<q	t||dQ|�n
dI|dQ<|S(TuW
    Filters given options and outputs valid settings for a
    network interface.
    unameuprotounoneubootpudhcpudnsuyesupeerdnsumtuuintegerubridgeuethtooluslaveubondubondinguBondudevtypeuvlanuVlanuipipuaddruautouAA:BB:CC:DD:EE:FFunetwork.interfacesuhwaddruethuEthernetuBridgeubypassfirewallu#net.bridge.bridge-nf-call-ip6tablesu"net.bridge.bridge-nf-call-iptablesu#net.bridge.bridge-nf-call-arptablesiiusysctl.persistuFailed to set sysctl: %suIPIPumy_inner_ipaddrumy_outer_ipaddru1.2.3.4uibu
InfiniBanduprefixunetmasku&Cannot use prefix and netmask togetheruipaddrumasterusrcaddrudelayudomainugatewayuuuidunicknameuzoneuipv6addruipv6gatewayuipaddrsu/uipv4 CIDR is invalidu	ipv6addrsuipv6 CIDR is invaliduenable_ipv6uonparentu
peerroutesudefrouteustpuipv6_peerdnsu
ipv6_defrouteuipv6_peerroutesu
ipv6_autoconfuipv4_failure_fataludhcpv6cunouonbootuTThe 'onboot' option is controlled by the 'enabled' option. Interface: %s Enabled: %suuserctluarpcheckuipaddr_startu
ipaddr_enduclonenum_startu
nm_controlled(ubridge(ubonduvlanubridgeuipip(R+R<t
ValueErrorR0R9RBRtsalttutilstvalidatetnettmactTruet__salt__R(R*RRtwarningterrortAttributeErrort	ipv4_addrRRtappendt	ipv6_addr(R-t
iface_typetenabledRtresultR/tethtooltbondingRARt	auto_addrtifacestbypassfirewallt
bridgectlstsysctl_valuetsysctlRtiR?tprefix((s6/usr/lib/python2.7/site-packages/salt/modules/rh_ip.pyt_parse_settings_ethWs<






	#



				




(
."















cC@sgtd�tj|�D��}i}d|krDt|dd�nx|D]}||||<qKW|S(u[
    Filters given options and outputs valid settings for
    the route settings file.
    cs@s'|]\}}|j�|fVqdS(N(tlower(t.0tktv((s6/usr/lib/python2.7/site-packages/salt/modules/rh_ip.pys	<genexpr>9suroutesuList of routes(tdictRt	iteritemst_raise_error_routes(RR-RSR((s6/usr/lib/python2.7/site-packages/salt/modules/rh_ip.pyt
_parse_routes3s
cC@s�td�tj|�D��}td�tj|�D��}|jdt�}|r\|ni}d}tt}d|kr�y<|d|d<tjj	j
|d�}td|d�Wq�tk
r�t
d|�q�Xn|d|d<dj|�}dj|�}tjj	j|d�}||krd|tkrH||d<qq|tkrq||d<qqn
t
d|�d	|kr�y#|d	|d	<td	|d	�Wq�tk
r�t
d	d
g�q�Xn|d	r�djtjj	j|d	�|�|d	<nt
d	d
g�d|kr�tjj	j|d�}	|	|krs|	tkrW||d<q�|	tkr�||d<q�q�t
d|�nxF|D]>}
|
d
kr�djtjj	j||
�|�||
<q�q�W|S(ud
    Filters given options and outputs valid settings for
    the global network settings file.
    cs@s'|]\}}|j�|fVqdS(N(R_(R`RaRb((s6/usr/lib/python2.7/site-packages/salt/modules/rh_ip.pys	<genexpr>Jscs@s'|]\}}|j�|fVqdS(N(R_(R`RaRb((s6/usr/lib/python2.7/site-packages/salt/modules/rh_ip.pys	<genexpr>Ksuretain_settingsuuenabledu
networkingu	{0}yes{0}u{0}no{0}uhostnameuserver1.example.comu	{1}{0}{1}u
nozeroconf(u
networkinguhostnameu
nozeroconf(RcRRdtgetRR(R*RDREtstringutilst	is_quotedRRCt_raise_error_networkR
tdequoteR=(R-tcurrenttretain_settingsRSt
quote_typeR/ttrue_valt	false_valt
networkingt
nozeroconfR((s6/usr/lib/python2.7/site-packages/salt/modules/rh_ip.pyt_parse_network_settingsDs\





&

*cC@s/t|||�}tj|�t|��dS(uB
    Log and raise an error with a logical formatted message.
    N(RRRLRM(RR
RR((s6/usr/lib/python2.7/site-packages/salt/modules/rh_ip.pyR+�s
cC@s,t||�}tj|�t|��dS(uB
    Log and raise an error with a logical formatted message.
    N(RRRLRM(R
RR((s6/usr/lib/python2.7/site-packages/salt/modules/rh_ip.pyRj�s
cC@s/t|||�}tj|�t|��dS(uB
    Log and raise an error with a logical formatted message.
    N(RRRLRM(RR
RR((s6/usr/lib/python2.7/site-packages/salt/modules/rh_ip.pyRe�s
c	C@s�yotjjj|d��Q}tjjj|j��j�}y|jd�Wnt	k
rcnX|SWdQXWnt
k
r�gSXdS(u2
    Reads and returns the contents of a file
    urbuN(RDREtfilestfopenRht
to_unicodetreadt
splitlinestremoveRCR=(R trfhtlines((s6/usr/lib/python2.7/site-packages/salt/modules/rh_ip.pyR�s!

cC@s�tjj||j|��}tjj|�sdd}|j||�}tj|�t|��ntj	j
j|d��#}|jtj	j
j|��WdQXdS(u
    Writes a file to disk
    u){0} cannot be written. {1} does not existuwN(tosR RR
texistsRRLRMRDRERtRutwriteRhtto_str(RtdatatfoldertpatterntfilenameRtfp_((s6/usr/lib/python2.7/site-packages/salt/modules/rh_ip.pyt_write_file_iface�s
cC@sAtjjj|d��#}|jtjjj|��WdQXdS(u
    Writes a file to disk
    uwN(RDRERtRuR~RhR(R�R�R�((s6/usr/lib/python2.7/site-packages/salt/modules/rh_ip.pyt_write_file_network�scC@s5|j�}y|jd�Wntk
r0nX|S(Nu(RxRyRC(R�R{((s6/usr/lib/python2.7/site-packages/salt/modules/rh_ip.pyt
_read_temp�s
cK@s5tdd }t||�}ytjd�}Wn%tjjk
rWtjd�dSX|j	i|d6|d6�}t
||tdj|��t
jjtdj|��}|d	kr	td
dj|�dt�td
d
j|�dt�tdd|�ntdd�|dr+t|�St|�S(u�
    Create a bond script in /etc/modprobe.d with the passed settings
    and load the bonding kernel module.

    CLI Example:

    .. code-block:: bash

        salt '*' ip.build_bond bond0 mode=balance-alb
    u	osreleaseiu
conf.jinjau"Could not load template conf.jinjauunameubondingu{0}.confu5ucmd.runu/sed -i -e "/^alias\s{0}.*/d" /etc/modprobe.conftpython_shellu1sed -i -e "/^options\s{0}.*/d" /etc/modprobe.confufile.appendu/etc/modprobe.confu	kmod.loadutest(RR9tJINJAtget_templatetjinja2t
exceptionstTemplateNotFoundRRLtrenderR�t_RH_NETWORK_CONF_FILESR
R|R RRJRR�R(Rtsettingstrh_majorR-ttemplateR�R ((s6/usr/lib/python2.7/site-packages/salt/modules/rh_ip.pyt
build_bond�s,


c
	K@s�tddkr2tddkr)d}qrd}n@tddkrdtddkr[d}qrd}ntd	d
 }|j�}|tkr�t||t�n|dkr�d|d<d
|kr�d}tj|�t|��q�n|dkr�d|d<n|dkrtdd�n|dkr�t||||�}yt	j
dj|��}Wn(tj
jk
r�tjd|�dSX|j|�}nd|kr�|dr�t|�St||td�tjjtdj|��}	t|	�S(u�
    Build an interface script for a network interface.

    CLI Example:

    .. code-block:: bash

        salt '*' ip.build_interface eth0 eth <settings>
    uosuFedorauosmajorreleaseiu7u6uAmazoniu	osreleaseiuslaveuyesumasteru1master is a required setting for slave interfacesuvlanubridgeupkg.installubridge-utilsuethubonduipipuibualiasurh{0}_eth.jinjau&Could not load template rh%s_eth.jinjauutestu	ifcfg-{0}(uethubondubridgeuslaveuvlanuipipuibualias(RR_t_IFACE_TYPESR+RRLRMRJR^R�R�R
R�R�R�R�R�R�t_RH_NETWORK_SCRIPT_DIRR|R RR(
RRQRRR�R�RR-R�tifcfgR ((s6/usr/lib/python2.7/site-packages/salt/modules/rh_ip.pytbuild_interface�sJ
				



c
K@sd}y'ttdd�dkr,d}nWntk
r@nXtjd|�t||�}tjdj|��ytj|�}Wn.t	j
jk
r�tjdj|��d	SXg}g}xQ|d
D]E}|d}t
jjjj|�r
|j|�q�|j|�q�Wtjd|�tjd
|�|jd|d|�}|jd|d|�}	|dr�t|�}
|
jt|	��|
St||td�t||	td�tjjtdj|��}tjjtdj|��}t|�}
|
jt|��|
S(u�
    Build a route script for a network interface.

    CLI Example:

    .. code-block:: bash

        salt '*' ip.build_routes eth0 <settings>
    urh6_route_eth.jinjau	osreleaseiiuroute_eth.jinjauTemplate name: uOpts: 
 {0}uCould not load template {0}uuroutesuipaddruIPv4 routes:
%suIPv6 routes:
%stroutesRutestu	route-{0}u
route6-{0}(R<RRCRtdebugRfR
R�R�R�R�R�RLRDRERFRGRPROR�R�textendR�R�R|R RR(
RR�R�R-topts6topts4troutetipaddrtroutecfgt	routecfg6R�R tpath6((s6/usr/lib/python2.7/site-packages/salt/modules/rh_ip.pytbuild_routes=sJ



cC@s'|dkr#tddj|��SdS(uq
    Shutdown a network interface

    CLI Example:

    .. code-block:: bash

        salt '*' ip.down eth0
    uslaveucmd.runu
ifdown {0}(uslaveN(RJR
tNone(RRQ((s6/usr/lib/python2.7/site-packages/salt/modules/rh_ip.pytdownwscC@s(tjjtdj|��}t|�S(u}
    Return the content of a bond script

    CLI Example:

    .. code-block:: bash

        salt '*' ip.get_bond bond0
    u{0}.conf(R|R RR�R
R(RR ((s6/usr/lib/python2.7/site-packages/salt/modules/rh_ip.pytget_bond�s
cC@s(tjjtdj|��}t|�S(u�
    Return the contents of an interface script

    CLI Example:

    .. code-block:: bash

        salt '*' ip.get_interface eth0
    u	ifcfg-{0}(R|R RR�R
R(RR ((s6/usr/lib/python2.7/site-packages/salt/modules/rh_ip.pyt
get_interface�s
cC@s'|dkr#tddj|��SdS(uo
    Start up a network interface

    CLI Example:

    .. code-block:: bash

        salt '*' ip.up eth0
    uslaveucmd.runuifup {0}(uslaveN(RJR
R�(RRQ((s6/usr/lib/python2.7/site-packages/salt/modules/rh_ip.pytup�scC@s_tjjtdj|��}tjjtdj|��}t|�}|jt|��|S(u�
    Return the contents of the interface routes script.

    CLI Example:

    .. code-block:: bash

        salt '*' ip.get_routes eth0
    u	route-{0}u
route6-{0}(R|R RR�R
RR�(RR R�R�((s6/usr/lib/python2.7/site-packages/salt/modules/rh_ip.pyt
get_routes�s

cC@s
tt�S(u�
    Return the contents of the global network script.

    CLI Example:

    .. code-block:: bash

        salt '*' ip.get_network_settings
    (Rt_RH_NETWORK_FILE(((s6/usr/lib/python2.7/site-packages/salt/modules/rh_ip.pytget_network_settings�s
cK@s�d|krt|d<nd|kr2t|d<nt}|dtkr�d|krktd|d�}q�tjd�t}nt}|dtkr�tjd�t}ntdd�}|o�|S(	u�
    Apply global network configuration.

    CLI Example:

    .. code-block:: bash

        salt '*' ip.apply_network_settings
    urequire_rebootuapply_hostnameuhostnameunetwork.mod_hostnameuUThe network state sls is trying to apply hostname changes but no hostname is defined.ubThe network state sls is requiring a reboot of the system to properly apply network configuration.uservice.restartunetwork(RRIR(RJRRK(R�thostname_restres((s6/usr/lib/python2.7/site-packages/salt/modules/rh_ip.pytapply_network_settings�s$


		cK@s�tt�}t||�}ytjd�}Wn%tjjk
rUtj	d�dSX|j
|�}|dryt|�St|t�t
t�S(u�
    Build the global network script.

    CLI Example:

    .. code-block:: bash

        salt '*' ip.build_network_settings <settings>
    u
network.jinjau%Could not load template network.jinjauutest(R'R�RsR�R�R�R�R�RRLR�R�R�R(R�tcurrent_network_settingsR-R�tnetwork((s6/usr/lib/python2.7/site-packages/salt/modules/rh_ip.pytbuild_network_settings�s



(Pt__doc__t
__future__RRRtloggingtos.pathR|R�tjinja2.exceptionstsalt.utils.filesRDtsalt.utils.stringutilstsalt.utils.templatestsalt.utils.validate.nettsalt.exceptionsRtsalt.extRt	getLoggert__name__RtEnvironmenttFileSystemLoaderR RREt	templatestTEMPLATE_DIRNAMER�RR	t_ETHTOOL_CONFIG_OPTSt_RH_CONFIG_OPTSt_RH_CONFIG_BONDING_OPTSR�R�R�RIR(RR*R�RRRRRR'R0R9R1R2R3R4R5R6R7RBR^RfRsR+RjReRR�R�R�R�R�R�R�R�R�R�R�R�R�R�(((s6/usr/lib/python2.7/site-packages/salt/modules/rh_ip.pyt<module>s�	$																		8	X	,	'	/	$	3	'	'		�		F												(	A	:						
	(

Zerion Mini Shell 1.0