MCPcopy Create free account
hub / github.com/mininet/mininet / precheck

Method precheck

examples/cluster.py:794–821  ·  view source on GitHub ↗

Pre-check to make sure connection works and that we can call sudo without a password

( self )

Source from the content-addressed store, hash-verified

792 pass
793
794 def precheck( self ):
795 """Pre-check to make sure connection works and that
796 we can call sudo without a password"""
797 result = 0
798 info( '*** Checking servers\n' )
799 for server in self.servers:
800 ip = self.serverIP[ server ]
801 if not server or server == 'localhost':
802 continue
803 info( server, '' )
804 dest = '%s@%s' % ( self.user, ip )
805 cmd = [ 'sudo', '-E', '-u', self.user ]
806 cmd += self.sshcmd + [ '-n', dest, 'sudo true' ]
807 debug( ' '.join( cmd ), '\n' )
808 _out, _err, code = errRun( cmd )
809 if code != 0:
810 error( '\nstartConnection: server connection check failed '
811 'to %s using command:\n%s\n'
812 % ( server, ' '.join( cmd ) ) )
813 result |= code
814 if result:
815 error( '*** Server precheck failed.\n'
816 '*** Make sure that the above ssh command works'
817 ' correctly.\n'
818 '*** You may also need to run mn -c on all nodes, and/or\n'
819 '*** use sudo -E.\n' )
820 sys.exit( 1 )
821 info( '\n' )
822
823 def modifiedaddHost( self, *args, **kwargs ):
824 "Slightly modify addHost"

Callers 1

__init__Method · 0.95

Calls 1

errRunFunction · 0.90

Tested by

no test coverage detected