Beispiel #1
0
    def startSession(self, device_id, password):
        """
        Start a new Session with a Device known to the Server.
        """

        try:
            return self.sendAndReceive(SystemRequestFactory.startSession(device_id).setPassword(password))
        except RuntimeError as e:
            if e.message == 'Received an empty response from the Agent. This normally means the remote service has crashed.':
                raise ConnectionError(e)
            else:
                raise
Beispiel #2
0
    def startSession(self, device_id, password):
        """
        Start a new Session with a Device known to the Server.
        """

        try:
            return self.sendAndReceive(
                SystemRequestFactory.startSession(device_id).setPassword(
                    password))
        except RuntimeError as e:
            if e.message == 'Received an empty response from the Agent. This normally means the remote service has crashed.':
                raise ConnectionError(e)
            else:
                raise
Beispiel #3
0
    def startSession(self, console, message):
        """
        Instantiates a new Session with the Agent, by sending a START_SESSION
        request.

        At some point in the future, the Agent will acknowledge the Session and
        the __startedSession() callback will be invoked to pass the session
        identifier back to the console.
        """

        self.onMessage(message.id, self.__startedSession(console))

        self.write(
            SystemRequestFactory.startSession(self.device_id).setPassword(
                message.system_request.password).setId(message.id).build())