Example #1
0
    def __rebootPWR(self):
        """ Reboot the peer using a power controller """
        # TODO: define PWR type (SSH, Telnet, etc)
        sshClient = SSHClient(
            self.peer.config['pwr_user'],
            self.peer.config['pwr_password'],
            self.peer.config['pwr_ip'],
            self.peer.config['pwr_rebootCmd'],
            port = 22,
            exitCmd = self.peer.config['pwr_exitCmd']
        )

        sshClient.join()
        if sshClient.exitcode == Status.CLOSED:
            sys.exit(0)
            return

        self.logger.warn('Cannot reboot peer %s(%s) using the Power Controller (%d)'
            %(self.peer.ipAddr, self.peer.macAddr, sshClient.exitcode))
Example #2
0
    def __rebootSSH(self):
        """ Reboot the peer using the SSH service """
        if self.removeLock:
            cmd =  'touch %s/unlock; ' % self.peer.config['tmpdir']
        else: cmd = ''

        sshClient = SSHClient(
            self.peer.config['user'],
            self.peer.config['password'],
            self.peer.ipAddr,
            '%s%s' % (cmd, self.peer.config['rebootcmd']),
        )

        sshClient.join()
        if sshClient.exitcode == Status.CLOSED:
            sys.exit(0)
            return

        self.logger.warn('Cannot reboot peer using SSH (%s)'
            %(sshClient.exitcode))