Пример #1
0
    def get_discover(self, agent_address, agent_port):
        try:
            self.logger.info("Getting discovery.")
            self.load_auth_cookie()
            self.start_db_session()
            self.check_admin()
            self.db_session.close()

            res = temboard_discover(self.ssl_ca_cert_file, agent_address,
                                    agent_port)
            self.logger.info("Done.")
            return JSONAsyncResult(200, res)

        except (TemboardUIError, TemboardError, Exception) as e:
            self.logger.traceback(get_tb())
            self.logger.error(str(e))
            self.logger.info("Failed.")
            try:
                self.db_session.close()
            except Exception:
                pass
            if isinstance(e, TemboardUIError) or isinstance(e, TemboardError):
                return JSONAsyncResult(e.code, {'error': e.message})
            else:
                return JSONAsyncResult(500, {'error': "Internal error."})
Пример #2
0
    def get_discover(self, agent_address, agent_port):
        self.logger.info("Getting discovery.")
        self.setUp()
        self.check_admin()

        res = temboard_discover(self.ssl_ca_cert_file, agent_address,
                                agent_port)
        self.tearDown(commit=False)
        self.logger.info("Done.")
        return JSONAsyncResult(200, res)
Пример #3
0
def discover(request, address, port):
    return temboard_discover(
        request.config.temboard.ssl_ca_cert_file, address, port)
Пример #4
0
def discover(request, address, port):
    key = request.headers['X-TemBoard-Agent-Key']
    return temboard_discover(
        request.config.temboard.ssl_ca_cert_file, address, port, key)