Called on an input line when the command prefix is not recognized. Overridden to run shell commands when a node is the first CLI argument. Past the first CLI argument, node names are automatically replaced with corresponding IP addrs.
( self, line )
| 414 | self.mn.waitConnected() |
| 415 | |
| 416 | def default( self, line ): |
| 417 | """Called on an input line when the command prefix is not recognized. |
| 418 | Overridden to run shell commands when a node is the first |
| 419 | CLI argument. Past the first CLI argument, node names are |
| 420 | automatically replaced with corresponding IP addrs.""" |
| 421 | |
| 422 | first, args, line = self.parseline( line ) |
| 423 | |
| 424 | if first in self.mn: |
| 425 | if not args: |
| 426 | error( '*** Please enter a command for node: %s <cmd>\n' |
| 427 | % first ) |
| 428 | return |
| 429 | node = self.mn[ first ] |
| 430 | rest = args.split( ' ' ) |
| 431 | # Substitute IP addresses for node names in command |
| 432 | # If updateIP() returns None, then use node name |
| 433 | rest = [ self.mn[ arg ].defaultIntf().updateIP() or arg |
| 434 | if arg in self.mn else arg |
| 435 | for arg in rest ] |
| 436 | rest = ' '.join( rest ) |
| 437 | # Run cmd on node: |
| 438 | node.sendCmd( rest ) |
| 439 | self.waitForNode( node ) |
| 440 | else: |
| 441 | error( '*** Unknown command: %s\n' % line ) |
| 442 | |
| 443 | def waitForNode( self, node ): |
| 444 | "Wait for a node to finish, and print its output." |
no test coverage detected