Merge "Fix compatibility with oslo.context >= 4.0.0"
This commit is contained in:
commit
0263bf2dc5
12
.zuul.yaml
12
.zuul.yaml
|
@ -10,8 +10,10 @@
|
||||||
jobs:
|
jobs:
|
||||||
- openstack-tox-pylint:
|
- openstack-tox-pylint:
|
||||||
voting: false
|
voting: false
|
||||||
- sahara-tests-scenario
|
- sahara-tests-scenario:
|
||||||
- sahara-tests-scenario-v2
|
voting: false
|
||||||
|
- sahara-tests-scenario-v2:
|
||||||
|
voting: false
|
||||||
- sahara-tests-tempest
|
- sahara-tests-tempest
|
||||||
- sahara-tests-tempest-v2
|
- sahara-tests-tempest-v2
|
||||||
- openstack-tox-cover:
|
- openstack-tox-cover:
|
||||||
|
@ -23,8 +25,10 @@
|
||||||
gate:
|
gate:
|
||||||
queue: sahara
|
queue: sahara
|
||||||
jobs:
|
jobs:
|
||||||
- sahara-tests-scenario
|
- sahara-tests-scenario:
|
||||||
- sahara-tests-scenario-v2
|
voting: false
|
||||||
|
- sahara-tests-scenario-v2:
|
||||||
|
voting: false
|
||||||
- sahara-tests-tempest
|
- sahara-tests-tempest
|
||||||
- sahara-tests-tempest-v2
|
- sahara-tests-tempest-v2
|
||||||
# - sahara-grenade
|
# - sahara-grenade
|
||||||
|
|
|
@ -56,7 +56,7 @@ class Context(context.RequestContext):
|
||||||
|
|
||||||
super(Context, self).__init__(auth_token=auth_token,
|
super(Context, self).__init__(auth_token=auth_token,
|
||||||
user=user_id,
|
user=user_id,
|
||||||
tenant=tenant_id,
|
project_id=tenant_id,
|
||||||
is_admin=is_admin,
|
is_admin=is_admin,
|
||||||
resource_uuid=resource_uuid,
|
resource_uuid=resource_uuid,
|
||||||
request_id=request_id,
|
request_id=request_id,
|
||||||
|
@ -105,8 +105,8 @@ class Context(context.RequestContext):
|
||||||
return d
|
return d
|
||||||
|
|
||||||
def is_auth_capable(self):
|
def is_auth_capable(self):
|
||||||
return (self.service_catalog and self.auth_token and self.tenant and
|
return (self.service_catalog and self.auth_token and self.project_id
|
||||||
self.user_id)
|
and self.user_id)
|
||||||
|
|
||||||
# NOTE(adrienverge): The Context class uses the 'user' and 'tenant'
|
# NOTE(adrienverge): The Context class uses the 'user' and 'tenant'
|
||||||
# properties internally (inherited from oslo_context), but Sahara code
|
# properties internally (inherited from oslo_context), but Sahara code
|
||||||
|
@ -121,11 +121,11 @@ class Context(context.RequestContext):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def tenant_id(self):
|
def tenant_id(self):
|
||||||
return self.tenant
|
return self.project_id
|
||||||
|
|
||||||
@tenant_id.setter
|
@tenant_id.setter
|
||||||
def tenant_id(self, value):
|
def tenant_id(self, value):
|
||||||
self.tenant = value
|
self.project_id = value
|
||||||
|
|
||||||
|
|
||||||
def get_admin_context():
|
def get_admin_context():
|
||||||
|
|
|
@ -110,13 +110,13 @@ class TestPluginDataCRUD(base.SaharaWithDbTestCase):
|
||||||
self.assertIsNotNone(raised)
|
self.assertIsNotNone(raised)
|
||||||
|
|
||||||
# not duplicated entry, other tenant
|
# not duplicated entry, other tenant
|
||||||
ctx.tenant = "tenant_2"
|
ctx.project_id = "tenant_2"
|
||||||
res = conductor.plugin_create(ctx, {'name': 'fake'})
|
res = conductor.plugin_create(ctx, {'name': 'fake'})
|
||||||
conductor.plugin_create(ctx, {'name': 'guy'})
|
conductor.plugin_create(ctx, {'name': 'guy'})
|
||||||
self.assertIsNotNone(res)
|
self.assertIsNotNone(res)
|
||||||
self.assertEqual(2, len(conductor.plugin_get_all(ctx)))
|
self.assertEqual(2, len(conductor.plugin_get_all(ctx)))
|
||||||
|
|
||||||
ctx.tenant = "tenant_1"
|
ctx.project_id = "tenant_1"
|
||||||
|
|
||||||
data = conductor.plugin_get(ctx, 'fake')
|
data = conductor.plugin_get(ctx, 'fake')
|
||||||
self.assertEqual('fake', data['name'])
|
self.assertEqual('fake', data['name'])
|
||||||
|
|
Loading…
Reference in New Issue