Ejemplo n.º 1
0
    def api_measurement_summary(self, request, measurement_id):
        try:
            measurement = get_measurement(measurement_id)
        except InsecurePath:
            raise WebUIError(500, "invalid measurement id")
        except MeasurementNotFound:
            raise WebUIError(404, "measurement not found")
        except MeasurementInProgress:
            raise WebUIError(400, "measurement in progress")

        if measurement['completed'] is False:
            raise WebUIError(400, "measurement in progress")

        summary = yield get_summary(measurement_id)
        defer.returnValue(self.render_json(summary, request))
Ejemplo n.º 2
0
    def api_measurement_summary(self, request, measurement_id):
        try:
            measurement = get_measurement(measurement_id)
        except InsecurePath:
            raise WebUIError(500, "invalid measurement id")
        except MeasurementNotFound:
            raise WebUIError(404, "measurement not found")
        except MeasurementInProgress:
            raise WebUIError(400, "measurement in progress")

        if measurement['completed'] is False:
            raise WebUIError(400, "measurement in progress")

        summary = yield get_summary(measurement_id)
        defer.returnValue(self.render_json(summary, request))
Ejemplo n.º 3
0
    def api_measurement_delete(self, request, measurement_id):
        try:
            measurement = get_measurement(measurement_id)
        except InsecurePath:
            raise WebUIError(500, "invalid measurement id")
        except MeasurementNotFound:
            raise WebUIError(404, "measurement not found")

        if measurement['running'] is True:
            raise WebUIError(400, "Measurement running")

        try:
            measurement_dir = self.measurement_path.child(measurement_id)
            measurement_dir.remove()
        except:
            raise WebUIError(400, "Failed to delete report")

        return self.render_json({"result": "ok"}, request)
Ejemplo n.º 4
0
    def api_measurement_delete(self, request, measurement_id):
        try:
            measurement = get_measurement(measurement_id)
        except InsecurePath:
            raise WebUIError(500, "invalid measurement id")
        except MeasurementNotFound:
            raise WebUIError(404, "measurement not found")

        if measurement['running'] is True:
            raise WebUIError(400, "Measurement running")

        try:
            measurement_dir = self.measurement_path.child(measurement_id)
            measurement_dir.remove()
        except:
            raise WebUIError(400, "Failed to delete report")

        return self.render_json({"result": "ok"}, request)