Fixed link check and updated quietRun interface.
Link check wasn't quite right - e.g. 'eth1' could be found in 'eth10' previously. Updated quietRun to allow passing in args directly rather than as a list.
This commit is contained in:
+4
-2
@@ -17,9 +17,11 @@ def checkRun( cmd ):
|
|||||||
cmd: list of command params"""
|
cmd: list of command params"""
|
||||||
return check_call( cmd.split( ' ' ) )
|
return check_call( cmd.split( ' ' ) )
|
||||||
|
|
||||||
def quietRun( cmd ):
|
def quietRun( *cmd ):
|
||||||
"""Run a command, routing stderr to stdout, and return the output.
|
"""Run a command, routing stderr to stdout, and return the output.
|
||||||
cmd: list of command params"""
|
cmd: list of command params"""
|
||||||
|
if len( cmd ) == 1:
|
||||||
|
cmd = cmd[ 0 ]
|
||||||
if isinstance( cmd, str ):
|
if isinstance( cmd, str ):
|
||||||
cmd = cmd.split( ' ' )
|
cmd = cmd.split( ' ' )
|
||||||
popen = Popen( cmd, stdout=PIPE, stderr=STDOUT )
|
popen = Popen( cmd, stdout=PIPE, stderr=STDOUT )
|
||||||
@@ -87,7 +89,7 @@ def moveIntfNoRetry( intf, node, printError=False ):
|
|||||||
cmd = 'ip link set ' + intf + ' netns ' + repr( node.pid )
|
cmd = 'ip link set ' + intf + ' netns ' + repr( node.pid )
|
||||||
quietRun( cmd )
|
quietRun( cmd )
|
||||||
links = node.cmd( 'ip link show' )
|
links = node.cmd( 'ip link show' )
|
||||||
if not intf in links:
|
if not ( ' %s:' % intf ) in links:
|
||||||
if printError:
|
if printError:
|
||||||
lg.error( '*** Error: moveIntf: ' + intf +
|
lg.error( '*** Error: moveIntf: ' + intf +
|
||||||
' not successfully moved to ' + node.name + '\n' )
|
' not successfully moved to ' + node.name + '\n' )
|
||||||
|
|||||||
Reference in New Issue
Block a user