Fix setDefaultRoute to work with passed parameters.
This commit is contained in:
+3
-7
@@ -420,16 +420,12 @@ class Node( object ):
|
|||||||
"""Set the default route to go through intf.
|
"""Set the default route to go through intf.
|
||||||
intf: Intf or {dev <intfname> via <gw-ip> ...}"""
|
intf: Intf or {dev <intfname> via <gw-ip> ...}"""
|
||||||
# Note setParam won't call us if intf is none
|
# Note setParam won't call us if intf is none
|
||||||
# See if interface is an actual interface
|
if type( intf ) is str and ' ' in intf:
|
||||||
intf = self.intf( intf )
|
|
||||||
if intf in self.ports:
|
|
||||||
params = 'dev %s' % intf
|
|
||||||
elif type( intf ) is str:
|
|
||||||
params = intf
|
params = intf
|
||||||
else:
|
else:
|
||||||
raise ValueError( 'intf or param string required' )
|
params = 'dev %s' % intf
|
||||||
self.cmd( 'ip route del default' )
|
self.cmd( 'ip route del default' )
|
||||||
return self.cmd( 'ip route add default dev %s' % intf )
|
return self.cmd( 'ip route add default', params )
|
||||||
|
|
||||||
# Convenience and configuration methods
|
# Convenience and configuration methods
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user