summaryrefslogtreecommitdiff
path: root/debian/patches/add-version-info.patch
blob: 1480107f46cde4d16f6a9a1b820e4cb88686d941 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
Description: Add version info for Ubuntu.
Author: Yolanda Robla <yolanda.robla@canonical.com>
--- a/etc/keystone.conf.sample
+++ b/etc/keystone.conf.sample
@@ -2839,3 +2839,6 @@
 # Keystone only provides a `sql` driver, so there is no reason to change this
 # unless you are providing a custom entry point. (string value)
 #driver = sql
+
+[extra_headers]
+Distribution = Ubuntu
--- a/keystone/common/wsgi.py
+++ b/keystone/common/wsgi.py
@@ -695,6 +695,11 @@ def render_response(body=None, status=No
         headers = list(headers)
     headers.append(('Vary', 'X-Auth-Token'))
 
+    # extra headers
+    for key, value in CONF.extra_headers.items():
+        if value != 'None':
+            headers.append(('X-'+key, value))
+
     if body is None:
         body = b''
         status = status or (http_client.NO_CONTENT,
--- a/keystone/conf/__init__.py
+++ b/keystone/conf/__init__.py
@@ -28,6 +28,7 @@ from keystone.conf import domain_config
 from keystone.conf import endpoint_filter
 from keystone.conf import endpoint_policy
 from keystone.conf import eventlet_server
+from keystone.conf import extra_headers
 from keystone.conf import federation
 from keystone.conf import fernet_tokens
 from keystone.conf import identity
@@ -62,6 +63,7 @@ conf_modules = [
     endpoint_filter,
     endpoint_policy,
     eventlet_server,
+    extra_headers,
     federation,
     fernet_tokens,
     identity,
--- /dev/null
+++ b/keystone/conf/extra_headers.py
@@ -0,0 +1,36 @@
+# 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
+# a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from oslo_config import cfg
+
+from keystone.conf import utils
+
+
+distribution = cfg.StrOpt(
+    'Distribution',
+    default='Ubuntu',
+    help=utils.fmt("""
+Specifies the distribution of the keystone server.
+"""))
+
+GROUP_NAME = __name__.split('.')[-1]
+ALL_OPTS = [
+    distribution,
+]
+
+
+def register_opts(conf):
+    conf.register_opts(ALL_OPTS, group=GROUP_NAME)
+
+
+def list_opts():
+    return {GROUP_NAME: ALL_OPTS}