File tree Expand file tree Collapse file tree 7 files changed +63
-25
lines changed
tests/unit/api/controllers Expand file tree Collapse file tree 7 files changed +63
-25
lines changed Original file line number Diff line number Diff line change @@ -35,20 +35,22 @@ Healthcheck Middleware
35
35
This piece of middleware creates an endpoint that allows a load balancer
36
36
to probe if the API endpoint should be available at the node or not.
37
37
38
- The healthcheck middleware should be placed early in the pipeline. Which
39
- is located in your ``api-paste.ini `` under a section called
40
- ``[filter :healthcheck] ``. It should look like this::
38
+ The healthcheck middleware should be deployed as a paste application
39
+ application. Which is located in your ``api-paste.ini `` under a section called
40
+ ``[app :healthcheck] ``. It should look like this::
41
41
42
- [filter :healthcheck]
43
- paste.filter_factory = oslo_middleware:Healthcheck.factory
42
+ [app :healthcheck]
43
+ paste.app_factory = oslo_middleware:Healthcheck.app_factory
44
44
backends = disable_by_file
45
45
disable_by_file_path = /etc/magnum/healthcheck_disable
46
46
47
- The main pipeline using this filter should look something like this also
47
+ The main pipeline using this application should look something like this also
48
48
defined in the ``api-paste.ini ``::
49
49
50
- [pipeline:main]
51
- pipeline = cors healthcheck request_id authtoken api_v1
50
+ [composite:main]
51
+ paste.composite_factory = magnum.api:root_app_factory
52
+ /: api
53
+ /healthcheck: healthcheck
52
54
53
55
If you wish to disable a middleware without taking it out of the
54
56
pipeline, you can create a file under the file path defined by
Original file line number Diff line number Diff line change 1
- [pipeline:main]
2
- pipeline = cors healthcheck http_proxy_to_wsgi request_id osprofiler authtoken api_v1
1
+ [composite:main]
2
+ paste.composite_factory = magnum.api:root_app_factory
3
+ /: api
4
+ /healthcheck: healthcheck
5
+
6
+ [pipeline:api]
7
+ pipeline = cors http_proxy_to_wsgi request_id osprofiler authtoken api_v1
3
8
4
9
[app:api_v1]
5
10
paste.app_factory = magnum.api.app:app_factory
@@ -18,8 +23,8 @@ paste.filter_factory = oslo_middleware:RequestId.factory
18
23
paste.filter_factory = oslo_middleware.cors:filter_factory
19
24
oslo_config_project = magnum
20
25
21
- [filter :healthcheck]
22
- paste.filter_factory = oslo_middleware:Healthcheck.factory
26
+ [app :healthcheck]
27
+ paste.app_factory = oslo_middleware:Healthcheck.app_factory
23
28
backends = disable_by_file
24
29
disable_by_file_path = /etc/magnum/healthcheck_disable
25
30
Original file line number Diff line number Diff line change
1
+ # Licensed under the Apache License, Version 2.0 (the "License");
2
+ # you may not use this file except in compliance with the License.
3
+ # You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+ import paste .urlmap
13
+
14
+
15
+ def root_app_factory (loader , global_conf , ** local_conf ):
16
+ return paste .urlmap .urlmap_factory (loader , global_conf , ** local_conf )
Original file line number Diff line number Diff line change 1
- [pipeline:main]
2
- pipeline = cors healthcheck request_id authtoken api_v1
1
+ [composite:main]
2
+ paste.composite_factory = magnum.api:root_app_factory
3
+ /: api
4
+ /healthcheck: healthcheck
5
+
6
+ [pipeline:api]
7
+ pipeline = cors request_id authtoken api_v1
3
8
4
9
[app:api_v1]
5
10
paste.app_factory = magnum.api.app:app_factory
@@ -14,7 +19,7 @@ paste.filter_factory = oslo_middleware:RequestId.factory
14
19
paste.filter_factory = oslo_middleware.cors:filter_factory
15
20
oslo_config_project = magnum
16
21
17
- [filter :healthcheck]
18
- paste.filter_factory = oslo_middleware:Healthcheck.factory
22
+ [app :healthcheck]
23
+ paste.app_factory = oslo_middleware:Healthcheck.app_factory
19
24
backends = disable_by_file
20
25
disable_by_file_path = /tmp/magnum_healthcheck_disable
Original file line number Diff line number Diff line change 1
- [pipeline:main]
2
- pipeline = cors healthcheck request_id authtoken api_v1
1
+ [composite:main]
2
+ paste.composite_factory = magnum.api:root_app_factory
3
+ /: api
4
+ /healthcheck: healthcheck
5
+
6
+ [pipeline:api]
7
+ pipeline = cors request_id authtoken api_v1
3
8
4
9
[app:api_v1]
5
10
paste.app_factory = magnum.api.app:app_factory
@@ -15,7 +20,7 @@ paste.filter_factory = oslo_middleware:RequestId.factory
15
20
paste.filter_factory = oslo_middleware.cors:filter_factory
16
21
oslo_config_project = magnum
17
22
18
- [filter :healthcheck]
19
- paste.filter_factory = oslo_middleware:Healthcheck.factory
23
+ [app :healthcheck]
24
+ paste.app_factory = oslo_middleware:Healthcheck.app_factory
20
25
backends = disable_by_file
21
26
disable_by_file_path = /tmp/magnum_healthcheck_disable
Original file line number Diff line number Diff line change 1
- [pipeline:main]
2
- pipeline = cors healthcheck request_id authtoken api_v1
1
+ [composite:main]
2
+ paste.composite_factory = magnum.api:root_app_factory
3
+ /: api
4
+ /healthcheck: healthcheck
5
+
6
+ [pipeline:api]
7
+ pipeline = cors request_id authtoken api_v1
3
8
4
9
[app:api_v1]
5
10
paste.app_factory = magnum.api.app:app_factory
@@ -15,7 +20,7 @@ paste.filter_factory = oslo_middleware:RequestId.factory
15
20
paste.filter_factory = oslo_middleware.cors:filter_factory
16
21
oslo_config_project = magnum
17
22
18
- [filter :healthcheck]
19
- paste.filter_factory = oslo_middleware:Healthcheck.factory
23
+ [app :healthcheck]
24
+ paste.app_factory = oslo_middleware:Healthcheck.app_factory
20
25
backends = disable_by_file
21
26
disable_by_file_path = /tmp/magnum_healthcheck_disable
Original file line number Diff line number Diff line change @@ -195,7 +195,7 @@ def setUp(self):
195
195
# Read current file and create new one
196
196
config = ConfigParser .RawConfigParser ()
197
197
config .read (self .get_path (paste_ini ))
198
- config .set ('filter :healthcheck' ,
198
+ config .set ('app :healthcheck' ,
199
199
'disable_by_file_path' ,
200
200
self .tempdir + "/disable" )
201
201
with open (self .tempdir + "/paste.ini" , 'wt' ) as configfile :
You can’t perform that action at this time.
0 commit comments