Add Support for Falcon 3.0.0, 3.0.1

- Support to new Falcon 3.0.0 and 3.0.1 keeping compatibility
for version 2.0.0

- Remove Falcon's class OptionalRepresentation
Starting from Falcon 3.0.0 version the class OptionalRepresentation
was removed. [1]

- Remove unnecessary URL slashes which are not compatible
with Falcon >= 3.0.0

- Keep facon.API instead of new falcon.App to keep support for
version 2.0.0

- Disable temporary docker-build and docker-publish Zuul jobs.

[1] https://falcon.readthedocs.io/en/stable/changes/3.0.0.html#breaking-changes

Change-Id: Ifb067429dd66fd350110187ac3a8b6a9977bad90
This commit is contained in:
Martin Chacon Piza
2021-06-04 11:50:32 +02:00
parent ae5dffc94c
commit a6e56ab63c
5 changed files with 10 additions and 22 deletions

View File

@@ -208,21 +208,11 @@
- monasca-tempest-log-python3-influxdb
- monasca-tempest-python3-influxdb
- monasca-tempest-python3-cassandra
- build-monasca-docker-image
gate:
queue: monasca
jobs:
- monasca-tempest-python3-influxdb
- monasca-tempest-log-python3-influxdb
post:
jobs:
- publish-monasca-api-docker-image
periodic:
jobs:
- publish-monasca-api-docker-image
release:
jobs:
- publish-monasca-api-docker-image
- job:
name: publish-monasca-api-docker-image

View File

@@ -1,5 +1,4 @@
# Copyright 2015 kornicameister@gmail.com
# Copyright 2015 FUJITSU LIMITED
# Copyright 2021 FUJITSU LIMITED
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
@@ -18,14 +17,13 @@ import falcon
HTTP_422 = '422 Unprocessable Entity'
class HTTPUnprocessableEntity(falcon.OptionalRepresentation, falcon.HTTPError):
class HTTPUnprocessableEntity(falcon.HTTPError):
"""HTTPUnprocessableEntity http error.
HTTPError that comes with '422 Unprocessable Entity' status
:argument: message(str) - meaningful description of what caused an error
:argument: kwargs - any other option defined in
:py:class:`falcon.OptionalRepresentation` and
:py:class:`falcon.HTTPError`
"""
def __init__(self, message, **kwargs):

View File

@@ -75,7 +75,7 @@ def launch_metrics_api(app):
app.add_route("/v2.0/metrics/names", metrics_names)
alarm_definitions = simport.load(cfg.CONF.dispatcher.alarm_definitions)()
app.add_route("/v2.0/alarm-definitions/", alarm_definitions)
app.add_route("/v2.0/alarm-definitions", alarm_definitions)
app.add_route("/v2.0/alarm-definitions/{alarm_definition_id}",
alarm_definitions)
@@ -84,7 +84,7 @@ def launch_metrics_api(app):
app.add_route("/v2.0/alarms/{alarm_id}", alarms)
alarm_count = simport.load(cfg.CONF.dispatcher.alarms_count)()
app.add_route("/v2.0/alarms/count/", alarm_count)
app.add_route("/v2.0/alarms/count", alarm_count)
alarms_state_history = simport.load(
cfg.CONF.dispatcher.alarms_state_history)()

View File

@@ -173,10 +173,10 @@ class TestAlarmsStateHistory(AlarmTestBase):
self.alarms_resource = alarms.AlarmsStateHistory()
self.app.add_route(
'/v2.0/alarms/{alarm_id}/state-history/', self.alarms_resource)
'/v2.0/alarms/{alarm_id}/state-history', self.alarms_resource)
self.app.add_route(
'/v2.0/alarms/state-history/', self.alarms_resource)
'/v2.0/alarms/state-history', self.alarms_resource)
def test_alarm_state_history(self):
expected_elements = {u"elements": [dict(ALARM_HISTORY)]}
@@ -1064,7 +1064,7 @@ class TestAlarmDefinition(AlarmTestBase):
self.alarm_definition_resource.send_event = Mock()
self._send_event = self.alarm_definition_resource.send_event
self.app.add_route("/v2.0/alarm-definitions/",
self.app.add_route("/v2.0/alarm-definitions",
self.alarm_definition_resource)
self.app.add_route("/v2.0/alarm-definitions/{alarm_definition_id}",
self.alarm_definition_resource)

View File

@@ -88,9 +88,9 @@ def validate_authorization(http_request, authorized_rules_list):
except Exception as ex:
LOG.debug(ex)
raise falcon.HTTPUnauthorized('Forbidden',
'The request does not have access to this service',
challenge)
raise falcon.HTTPUnauthorized(title='Forbidden',
description='The request does not have access to this service',
challenges=challenge)
def validate_payload_size(content_length):