Commit Graph

19 Commits

Author SHA1 Message Date
Brian Rosmaita f102b74a28 Remove 'admin_role' option
This option was deprecated in the Ussuri release by change
I0f61f85a0aaa4f68e345fa08fbb6b039d3d32587 and it is now eligible
for removal following the standard OpenStack deprecation policy.

Change-Id: I78ec79f97bfdcc39772448296140f8d8f35adea1
2020-11-24 20:31:21 -05:00
Matt Riedemann 88a8ad7823 Fix DeprecationWarnings for RequestContext.tenant/user usage
RequestContext.tenant and user fields are deprecated in favor
of project_id and user_id respectively.

This change modifies the glance.context.RequestContext constructor
to transition usage of tenant/user to project_id/user_id until
all tests are moved over to the new attributes. Runtime usage of
the old fiels is updated.

To prevent new code from using the deprecated fields, a warnings
filter is added which will make tests fail if they hit code using
the old fields.

Co-Authored-By: Abhishek Kekane <akekane@redhat.com>
Change-Id: I351380840308a24769ece93abc6d1a9a6d6aa06f
2019-02-06 09:59:36 -05:00
Victor Stinner 1e31633288 Support Unicode request_id on Python 3
The oslo.context change If48ee7f4d1c113f1f26b3b1698c6b055807b950f
will change request_id type on Python 3 from bytes to str. This
change prepares Glance for this change.

Change-Id: Ia8578ecab1b1f1bf21020c91290458efad646cd9
2015-11-27 15:44:54 +01:00
Abhijeet Malawade 5085aff80f Fix Request ID has a double 'req-' at the start
Check if request-id starts with 'req-' in context middleware,
if not then add prefix 'req-' to request-id.

Change-Id: I4fae1f6274b5d89fd3bdd1aefd4abc2129afd8ef
Closes-Bug: #1478690
2015-08-05 23:15:06 -07:00
Julien Danjou 84955d6353 Simplify context by using oslo.context
This is a first step toward removing Glance specific context object.

Change-Id: I0125811e1afeccb5896c9bcb4447cd7fac58f247
2015-02-02 09:51:52 +01:00
Jenkins 453706b4b3 Merge "Make RequestContext use auth_token (not auth_tok)" 2014-11-10 14:58:32 +00:00
Brian D. Elliott 2652a3a528 Fix context storage bug
Fix a bug with storing the request context in thread local where the
storage was not properly cleared between requests.

(This was causing the same request to always be logged.)

Closes-Bug: 1384911
Change-Id: Ie30b93900451b0f9f6fd8158457b0b66903af470
2014-10-29 21:34:51 +00:00
Stuart McLaren cc7ae2abd5 Make RequestContext use auth_token (not auth_tok)
The RequestContext class from oslo-incubator uses 'auth_token'.
Glance's RequestContext uses 'auth_tok' -- which is inconsistent.

glance_store currently uses the oslo 'auth_token'.

We should not assume a 1-1 mapping from the glance_store to glance,
nor should we have glance_store support both 'auth_token' and
'auth_tok'. Therefore Glance should be updated to use 'auth_token'.

This change was generated automatically with:

$ for file in `find glance -name '*\.py' -exec grep -wl auth_tok "{}" \;` ; \
  do sed --in-place 's/\<auth_tok\>/auth_token/g' $file ; done

In addition, the set_auth_token function was removed. This had been used
by Nova to work around the auth_tok <-> auth_token inconsistency, but
was removed in mid-2012 as part of the move to python-glanceclient so
is no longer needed.

In conjuction with other changes this fixes image upload when
using the multi-tenant Swift store.

Change-Id: Ic8a5f44088990fd8f6290a5622b823f59ef365fc
Partial-bug: #1385213
2014-10-28 15:39:21 +00:00
liyingjun 2365a3fb5f Fix assertEqual arguments order
assertEqual method's arguments should be in ('expected', 'actual')
order.

Change-Id: I88b5b0558720a91236b62b6e4a3590901e817f85
Closes-bug: 1277104
2014-09-19 00:25:18 +08:00
Jia Dong 8d4312a2c9 Modify assert statement when comparing with None
Replace assertEqual(None, *) with assertIsNone in glance's
tests to have more clear messages in case of failure.

Also, replace assertTrue(* is not None) with assertIsNotNone
for the same reason.

Change-Id: If41a71bd750057c7136b03bef94c04517092134c
Closes-Bug: #1280522
2014-02-19 14:37:41 +08:00
Yanis Guenane 317ad31637 Make Glance code base H102 compliant
Add the Apache headers where it was missing so the Glance
code base can be H102 compliant

Change-Id: If19841d1752f7ec364098333429ce090374e79cd
Closes-bug: #1263537
2013-12-23 13:12:12 +00:00
Zhongyue Luo cb64f58b99 Clean up pep8 E128 violations
Fixed E128 errors
All ignores are to be removed in the next sequence of patches

Change-Id: I3ccff7df8c382f83ae6aa9aa6a7f16324c3aec75
2012-10-09 10:04:19 +08:00
Dan Prince 444ad454b7 Adds service_catalog to the context.
Updates the ContextMiddleware so that it stores the service_catalog
which from set via Keystone's auth_token middleware.

The motivation for this change is that we'll need access to the
'object-store' endpoint in order to implement swift tenant specific
storage.

Partially implements blueprint: swift-tenant-specific-storage

Change-Id: I0389e135f6683a353ae915b543d70f6ac1246b2c
2012-07-12 14:55:43 -04:00
Brian Waldon 06f7fe92a6 Generate request id and return in header to client
* Generate a uuid in RequestContext.request_id on init
* Present request_id in an 'x-openstack-request-id' header using
  process_response in the ContextMiddlewares
* Related to bp glance-request-tracking

Change-Id: Idd9b86661322250b6167a1ee23e5baae91066ff6
2012-07-10 08:42:11 -07:00
Brian Waldon ce899351da Reorganize context module
* Move RequestContext class to glance.context
* Move context middlewares to glance.api.middleware
* Update tests to reflect move
* Update paste configs

Related to bp glance-request-tracking

Change-Id: I289b546ec28c973a3022be779ce378ae2febb340
2012-07-10 08:31:50 -07:00
Alessio Ababilov 081823ad86 make roles case-insensitive
Fix bug #1010519

Change-Id: I5b4a50e2d546ba8b4b018178af09707bc4d31fce
2012-06-19 10:23:02 +03:00
Mark McLoughlin d33ce445d3 Remove the conf passing PasteDeploy factories
Implements blueprint cfg-global-object

In glance.common.wsgi we have a paste_deploy_app() API which allows
a ConfigOpts instance to be passed the the applications and filters
constructed by PasteDeploy.

Now that we're using a global object, we don't need this anymore

Change-Id: I222d3c58308bc2f504cd802c0c8405d3baa2e49a
2012-06-08 17:36:26 +01:00
Mark McLoughlin 9d9d225419 Port remaining code to global conf object
Implements blueprint cfg-global-object

This iteration fixes up the remaining places where we're passing a
conf object around.

Change-Id: I3b627d093a6b7afeee129ab66b377a3b0af5439b
2012-06-08 17:36:25 +01:00
Brian Waldon 2a01e6ef75 Enable anonymous access through context middleware
Certain deployments need to allow anonymous access to its
images. This patch allows a user that has failed to authenticate with
Keystone to access the API in read-only context.

* Configure through 'allow_anonymous_access' option, defaults to False
* Implements bp api-v2-anonymous-access

Change-Id: Ia8f57e54bd141a2da1ca4600d1970558fb497f67
2012-05-28 20:44:14 +01:00