Ejemplo n.º 1
0
def wsgi_app_v21(inner_app_v21=None,
                 fake_auth_context=None,
                 use_no_auth=False,
                 ext_mgr=None,
                 init_only=None,
                 v2_compatible=False):
    if not inner_app_v21:
        inner_app_v21 = compute.APIRouterV21(init_only)

    if v2_compatible:
        inner_app_v21 = openstack_api.LegacyV2CompatibleWrapper(inner_app_v21)

    if use_no_auth:
        api_v21 = openstack_api.FaultWrapper(
            auth.NoAuthMiddleware(
                limits.RateLimitingMiddleware(inner_app_v21)))
    else:
        if fake_auth_context is not None:
            ctxt = fake_auth_context
        else:
            ctxt = context.RequestContext('fake', 'fake', auth_token=True)
        api_v21 = openstack_api.FaultWrapper(
            api_auth.InjectContext(
                ctxt, limits.RateLimitingMiddleware(inner_app_v21)))

    mapper = urlmap.URLMap()
    mapper['/v2'] = api_v21
    mapper['/v2.1'] = api_v21
    mapper['/'] = openstack_api.FaultWrapper(versions.Versions())
    return mapper
Ejemplo n.º 2
0
    def wrap(app, use_context=False):
        if v2_compatible:
            app = openstack_api.LegacyV2CompatibleWrapper(app)

        if use_context:
            if fake_auth_context is not None:
                ctxt = fake_auth_context
            else:
                ctxt = context.RequestContext(
                    'fake', FAKE_PROJECT_ID, auth_token=True)
            app = api_auth.InjectContext(ctxt, app)

        app = openstack_api.FaultWrapper(app)

        return app
Ejemplo n.º 3
0
def wsgi_app_v21(fake_auth_context=None, v2_compatible=False):

    inner_app_v21 = compute.APIRouterV21()

    if v2_compatible:
        inner_app_v21 = openstack_api.LegacyV2CompatibleWrapper(inner_app_v21)

    if fake_auth_context is not None:
        ctxt = fake_auth_context
    else:
        ctxt = context.RequestContext('fake', 'fake', auth_token=True)
    api_v21 = openstack_api.FaultWrapper(
        api_auth.InjectContext(ctxt, inner_app_v21))
    mapper = urlmap.URLMap()
    mapper['/v2'] = api_v21
    mapper['/v2.1'] = api_v21
    mapper['/'] = openstack_api.FaultWrapper(versions.Versions())
    return mapper