예제 #1
0
    def renderMonitorStatus(self, db_result, machine_name, request):

        if len(db_result) == 0:
            request.setResponseCode(404)
            request.write('No entry for %s' % machine_name)
            request.finish()

        elif len(db_result) == 1:
            reg_epoch = db_result[0][0]
            payload = json.dumps( { REGISTRATION_EPOCH : reg_epoch } )
            request.setHeader(HTTP_HEADER_CONTENT_TYPE, JSON_MIME_TYPE)
            request.write(payload)
            request.finish()

        else:
            log.msg('Error: Got multiple results for monitor status (should not happen)', system='sgas.MonitorResource')
            log.msg('Database result: %s' % str(db_result), system='sgas.MonitorResource')
            request.setResponseCode(500)
            request.write('Internal error in monitor resource (got multiple results)')
            request.finish()
예제 #2
0
    def renderMonitorStatus(self, db_result, machine_name, request):

        if len(db_result) == 0:
            request.setResponseCode(404)
            request.write('No entry for %s' % machine_name)
            request.finish()

        elif len(db_result) == 1:
            reg_epoch = db_result[0][0]
            payload = json.dumps({REGISTRATION_EPOCH: reg_epoch})
            request.setHeader(HTTP_HEADER_CONTENT_TYPE, JSON_MIME_TYPE)
            request.write(payload)
            request.finish()

        else:
            log.msg(
                'Error: Got multiple results for monitor status (should not happen)',
                system='sgas.MonitorResource')
            log.msg('Database result: %s' % str(db_result),
                    system='sgas.MonitorResource')
            request.setResponseCode(500)
            request.write(
                'Internal error in monitor resource (got multiple results)')
            request.finish()
예제 #3
0
 def gotDatabaseResult(rows):
     records = queryrowrp.buildDictRecords(rows, query_args)
     payload = json.dumps(records)
     request.setHeader(HTTP_HEADER_CONTENT_TYPE, JSON_MIME_TYPE)
     request.write(payload)
     request.finish()
예제 #4
0
 def insertDone(result):
     request.write(json.dumps(result))
     request.finish()
예제 #5
0
 def insertDone(result):
     request.write(json.dumps(result))
     request.finish()
예제 #6
0
 def gotDatabaseResult(rows):
     payload = json.dumps(rows)
     request.setHeader(HTTP_HEADER_CONTENT_TYPE, JSON_MIME_TYPE)
     request.write(payload)
     request.finish()
예제 #7
0
 def gotDatabaseResult(rows):
     payload = json.dumps(rows)
     request.setHeader(HTTP_HEADER_CONTENT_TYPE, JSON_MIME_TYPE)
     request.write(payload)
     request.finish()