Fix gate issues
Subscription options returned by the controller get methods was not unserialized propertly, still containing msgpack data. It also changes so that mongo doesn't connect before forking, and fix uwsgi persistent connections (non) support. Finally, it changes how keystone options are registered to use a more robust and supported mechanism. Change-Id: I917a893c0d7175e3a465cf08c5e0375d9944fd16
This commit is contained in:
parent
0c6babe1b3
commit
4ba0225e1f
@ -142,6 +142,7 @@ function configure_zaqar {
|
||||
iniset $ZAQAR_UWSGI_CONF uwsgi wsgi-file $ZAQAR_DIR/zaqar/transport/wsgi/app.py
|
||||
iniset $ZAQAR_UWSGI_CONF uwsgi callable app
|
||||
iniset $ZAQAR_UWSGI_CONF uwsgi master true
|
||||
iniset $ZAQAR_UWSGI_CONF uwsgi add-header "Connection: close"
|
||||
|
||||
cleanup_zaqar
|
||||
}
|
||||
@ -200,6 +201,7 @@ function install_zaqarclient {
|
||||
|
||||
# start_zaqar() - Start running processes, including screen
|
||||
function start_zaqar {
|
||||
cat $ZAQAR_UWSGI_CONF
|
||||
run_process zaqar-wsgi "uwsgi --ini $ZAQAR_UWSGI_CONF --pidfile2 $ZAQAR_UWSGI_MASTER_PIDFILE"
|
||||
run_process zaqar-websocket "zaqar-server --config-file $ZAQAR_CONF"
|
||||
|
||||
|
@ -41,7 +41,7 @@ def _connection(conf):
|
||||
MongoClient = pymongo.MongoClient
|
||||
|
||||
if conf.uri and 'ssl=true' in conf.uri.lower():
|
||||
kwargs = {}
|
||||
kwargs = {'connect': False}
|
||||
|
||||
# Default to CERT_REQUIRED
|
||||
ssl_cert_reqs = ssl.CERT_REQUIRED
|
||||
@ -63,7 +63,7 @@ def _connection(conf):
|
||||
|
||||
return MongoClient(uri, **kwargs)
|
||||
|
||||
return MongoClient(uri)
|
||||
return MongoClient(uri, connect=False)
|
||||
|
||||
|
||||
class DataDriver(storage.DataDriverBase):
|
||||
|
@ -298,7 +298,7 @@ def _hmap_to_subenv_kwargs(hmap):
|
||||
'subscriber': hmap[b'u'],
|
||||
'ttl': int(hmap[b't']),
|
||||
'expires': int(hmap[b'e']),
|
||||
'options': hmap[b'o']
|
||||
'options': _unpack(hmap[b'o'])
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,35 +0,0 @@
|
||||
# Copyright (c) 2013 Red Hat, Inc.
|
||||
#
|
||||
# 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.
|
||||
|
||||
"""Test Auth."""
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
from zaqar import tests as testing
|
||||
from zaqar.transport import auth
|
||||
|
||||
|
||||
class TestTransportAuth(testing.TestBase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestTransportAuth, self).setUp()
|
||||
self.cfg = cfg.ConfigOpts()
|
||||
|
||||
def tearDown(self):
|
||||
super(TestTransportAuth, self).tearDown()
|
||||
|
||||
def test_configs(self):
|
||||
auth.strategy('keystone')._register_opts(self.cfg)
|
||||
self.assertIn('keystone_authtoken', self.cfg)
|
@ -16,7 +16,6 @@
|
||||
"""Middleware for handling authorization and authentication."""
|
||||
|
||||
from keystonemiddleware import auth_token
|
||||
from keystonemiddleware import opts
|
||||
from oslo_log import log
|
||||
|
||||
|
||||
@ -43,30 +42,14 @@ class SignedHeadersAuth(object):
|
||||
|
||||
class KeystoneAuth(object):
|
||||
|
||||
OPT_GROUP_NAME = 'keystone_authtoken'
|
||||
|
||||
@classmethod
|
||||
def _register_opts(cls, conf):
|
||||
"""Register keystonemiddleware options."""
|
||||
|
||||
options = []
|
||||
keystone_opts = opts.list_auth_token_opts()
|
||||
for n in keystone_opts:
|
||||
if n[0] == cls.OPT_GROUP_NAME:
|
||||
options = n[1]
|
||||
break
|
||||
|
||||
if cls.OPT_GROUP_NAME not in conf:
|
||||
conf.register_opts(options, group=cls.OPT_GROUP_NAME)
|
||||
auth_token.CONF = conf
|
||||
|
||||
@classmethod
|
||||
def install(cls, app, conf):
|
||||
"""Install Auth check on application."""
|
||||
LOG.debug(u'Installing Keystone\'s auth protocol')
|
||||
cls._register_opts(conf)
|
||||
conf = dict(conf.get(cls.OPT_GROUP_NAME))
|
||||
return auth_token.AuthProtocol(app, conf=conf)
|
||||
|
||||
return auth_token.AuthProtocol(app,
|
||||
conf={"oslo-config-config": conf,
|
||||
"oslo-config-project": "zaqar"})
|
||||
|
||||
|
||||
STRATEGIES['keystone'] = KeystoneAuth
|
||||
|
Loading…
Reference in New Issue
Block a user