Add some temp config vars to disable keystone and use a default tenant/user instead.

This commit is contained in:
Kiall Mac Innes 2012-10-03 18:59:07 +01:00
parent 9ad2e6e8df
commit e90a0fd76a
3 changed files with 22 additions and 7 deletions

View File

@ -35,8 +35,9 @@ logging.setup('moniker')
if cfg.CONF.verbose or cfg.CONF.debug:
app.debug = True
# Add Keystone Middleware
middleware_conf = {'delay_auth_decision': False}
app.wsgi_app = auth_token.AuthProtocol(app.wsgi_app, middleware_conf)
if cfg.CONF.enable_keystone:
# Add Keystone Middleware
middleware_conf = {'delay_auth_decision': False}
app.wsgi_app = auth_token.AuthProtocol(app.wsgi_app, middleware_conf)
app.run(host=cfg.CONF.api_host, port=cfg.CONF.api_port)

View File

@ -20,10 +20,20 @@ cfg.CONF.register_opts([
cfg.StrOpt('host', default=socket.gethostname(),
help='Name of this node'),
cfg.StrOpt('control_exchange', default='moniker',
help='AMQP exchange to connect to if using RabbitMQ or Qpid'),
help='AMQP exchange to connect to if using RabbitMQ or Qpid'),
cfg.StrOpt('central-topic', default='central', help='Central Topic'),
cfg.StrOpt('agent-topic', default='agent', help='Agent Topic'),
cfg.StrOpt('state-path', default='/var/lib/moniker', help='State Path'),
cfg.StrOpt('templates-path', default='/usr/share/moniker/templates',
help='Templates Path'),
cfg.StrOpt('templates-path', default='/usr/share/moniker/templates',
help='Templates Path'),
# Temp Config Options
cfg.BoolOpt('enable-keystone', default=False,
help='Disable Keystone Integration'),
cfg.StrOpt('default-tenant', default='12345',
help='Tenant to use when keystone is disabled'),
cfg.StrOpt('default-user', default='12345',
help='User to use when keystone is disabled'),
])

View File

@ -43,6 +43,10 @@ def attach_context():
request = flask.request
headers = request.headers
request.context = RequestContext(auth_tok=headers.get('X-Auth-Token'),
user=headers.get('X-User-ID'),
tenant=headers.get('X-Tenant-ID'))
if cfg.CONF.enable_keystone:
request.context = RequestContext(auth_tok=headers.get('X-Auth-Token'),
user=headers.get('X-User-ID'),
tenant=headers.get('X-Tenant-ID'))
else:
request.context = RequestContext(user=cfg.CONF.default_user,
tenant=cfg.CONF.default_tenant)