Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-oslo.context for
openSUSE:Factory checked in at 2022-06-19 21:11:44
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-oslo.context (Old)
and /work/SRC/openSUSE:Factory/.python-oslo.context.new.1548 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-oslo.context"
Sun Jun 19 21:11:44 2022 rev:19 rq:983771 version:4.1.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-oslo.context/python-oslo.context.changes
2021-10-27 22:21:22.687203964 +0200
+++
/work/SRC/openSUSE:Factory/.python-oslo.context.new.1548/python-oslo.context.changes
2022-06-19 21:12:01.562229835 +0200
@@ -1,0 +2,11 @@
+Tue Jun 7 09:16:22 UTC 2022 - [email protected]
+
+- update to version 4.1.0
+ - Don't test with setuptools local distutils.
+ - Remove the deprecated argument tenant from RequestContext
+ - Update master for stable/xena
+ - Integrate mypy
+ - Add Python3 yoga unit tests
+ - Fix context from_dict() for system_scope
+
+-------------------------------------------------------------------
Old:
----
oslo.context-3.3.1.tar.gz
New:
----
oslo.context-4.1.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-oslo.context.spec ++++++
--- /var/tmp/diff_new_pack.IHvXEK/_old 2022-06-19 21:12:01.966230436 +0200
+++ /var/tmp/diff_new_pack.IHvXEK/_new 2022-06-19 21:12:01.974230448 +0200
@@ -1,7 +1,7 @@
#
# spec file for package python-oslo.context
#
-# Copyright (c) 2021 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -18,13 +18,13 @@
%bcond_without test
Name: python-oslo.context
-Version: 3.3.1
+Version: 4.1.0
Release: 0
Summary: OpenStack Oslo context library
License: Apache-2.0
Group: Development/Languages/Python
URL: https://docs.openstack.org/oslo.context
-Source0:
https://files.pythonhosted.org/packages/source/o/oslo.context/oslo.context-3.3.1.tar.gz
+Source0:
https://files.pythonhosted.org/packages/source/o/oslo.context/oslo.context-4.1.0.tar.gz
BuildRequires: openstack-macros
BuildRequires: python3-pbr >= 2.0.0
BuildArch: noarch
@@ -63,7 +63,7 @@
Documentation for the oslo-context library.
%prep
-%autosetup -p1 -n oslo.context-3.3.1
+%autosetup -p1 -n oslo.context-4.1.0
%py_req_cleanup
%build
++++++ oslo.context-3.3.1.tar.gz -> oslo.context-4.1.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/oslo.context-3.3.1/.zuul.yaml
new/oslo.context-4.1.0/.zuul.yaml
--- old/oslo.context-3.3.1/.zuul.yaml 2021-08-19 14:36:52.000000000 +0200
+++ new/oslo.context-4.1.0/.zuul.yaml 2022-02-16 19:48:48.000000000 +0100
@@ -2,7 +2,7 @@
templates:
- check-requirements
- lib-forward-testing-python3
- - openstack-python3-xena-jobs
+ - openstack-python3-yoga-jobs
- periodic-stable-jobs
- publish-openstack-docs-pti
- release-notes-jobs-python3
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/oslo.context-3.3.1/AUTHORS
new/oslo.context-4.1.0/AUTHORS
--- old/oslo.context-3.3.1/AUTHORS 2021-08-19 14:38:39.000000000 +0200
+++ new/oslo.context-4.1.0/AUTHORS 2022-02-16 19:49:28.000000000 +0100
@@ -32,6 +32,7 @@
Kirill Bespalov <[email protected]>
Lance Bragstad <[email protected]>
Michael Basnight <[email protected]>
+Michael Johnson <[email protected]>
Mois??s Guimar??es de Medeiros <[email protected]>
Monty Taylor <[email protected]>
Morgan Fainberg <[email protected]>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/oslo.context-3.3.1/ChangeLog
new/oslo.context-4.1.0/ChangeLog
--- old/oslo.context-3.3.1/ChangeLog 2021-08-19 14:38:39.000000000 +0200
+++ new/oslo.context-4.1.0/ChangeLog 2022-02-16 19:49:28.000000000 +0100
@@ -1,6 +1,24 @@
CHANGES
=======
+4.1.0
+-----
+
+* Integrate mypy
+
+4.0.0
+-----
+
+* Don't test with setuptools local distutils
+* Remove the deprecated argument tenant from RequestContext
+
+3.4.0
+-----
+
+* Add Python3 yoga unit tests
+* Update master for stable/xena
+* Fix context from\_dict() for system\_scope
+
3.3.1
-----
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/oslo.context-3.3.1/PKG-INFO
new/oslo.context-4.1.0/PKG-INFO
--- old/oslo.context-3.3.1/PKG-INFO 2021-08-19 14:38:39.219790200 +0200
+++ new/oslo.context-4.1.0/PKG-INFO 2022-02-16 19:49:28.687795000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 1.2
Name: oslo.context
-Version: 3.3.1
+Version: 4.1.0
Summary: Oslo Context library
Home-page: https://docs.openstack.org/oslo.context/latest/
Author: OpenStack
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/oslo.context-3.3.1/oslo.context.egg-info/PKG-INFO
new/oslo.context-4.1.0/oslo.context.egg-info/PKG-INFO
--- old/oslo.context-3.3.1/oslo.context.egg-info/PKG-INFO 2021-08-19
14:38:39.000000000 +0200
+++ new/oslo.context-4.1.0/oslo.context.egg-info/PKG-INFO 2022-02-16
19:49:28.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 1.2
Name: oslo.context
-Version: 3.3.1
+Version: 4.1.0
Summary: Oslo Context library
Home-page: https://docs.openstack.org/oslo.context/latest/
Author: OpenStack
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/oslo.context-3.3.1/oslo.context.egg-info/SOURCES.txt
new/oslo.context-4.1.0/oslo.context.egg-info/SOURCES.txt
--- old/oslo.context-3.3.1/oslo.context.egg-info/SOURCES.txt 2021-08-19
14:38:39.000000000 +0200
+++ new/oslo.context-4.1.0/oslo.context.egg-info/SOURCES.txt 2022-02-16
19:49:28.000000000 +0100
@@ -43,9 +43,11 @@
oslo_context/tests/__init__.py
oslo_context/tests/test_context.py
oslo_context/tests/test_fixture.py
+releasenotes/notes/Fix-system-scope-from_dict-29615af90723ba4d.yaml
releasenotes/notes/add_reno-3b4ae0789e9c45b4.yaml
releasenotes/notes/dont-leak-auth-token-fb7075316cf87b7c.yaml
releasenotes/notes/drop-python27-support-b421329839e69d41.yaml
+releasenotes/notes/remove_deprecated_args_tenant-77724de1422f46d9.yaml
releasenotes/source/conf.py
releasenotes/source/index.rst
releasenotes/source/newton.rst
@@ -59,5 +61,6 @@
releasenotes/source/ussuri.rst
releasenotes/source/victoria.rst
releasenotes/source/wallaby.rst
+releasenotes/source/xena.rst
releasenotes/source/_static/.placeholder
releasenotes/source/_templates/.placeholder
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/oslo.context-3.3.1/oslo.context.egg-info/pbr.json
new/oslo.context-4.1.0/oslo.context.egg-info/pbr.json
--- old/oslo.context-3.3.1/oslo.context.egg-info/pbr.json 2021-08-19
14:38:39.000000000 +0200
+++ new/oslo.context-4.1.0/oslo.context.egg-info/pbr.json 2022-02-16
19:49:28.000000000 +0100
@@ -1 +1 @@
-{"git_version": "641a1e0", "is_release": true}
\ No newline at end of file
+{"git_version": "3400cc2", "is_release": true}
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/oslo.context-3.3.1/oslo_context/context.py
new/oslo.context-4.1.0/oslo_context/context.py
--- old/oslo.context-3.3.1/oslo_context/context.py 2021-08-19
14:36:52.000000000 +0200
+++ new/oslo.context-4.1.0/oslo_context/context.py 2022-02-16
19:48:48.000000000 +0100
@@ -30,6 +30,7 @@
import functools
import itertools
import threading
+import typing as ty
import uuid
import warnings
@@ -41,27 +42,21 @@
# These arguments will be passed to a new context from the first available
# header to support backwards compatibility.
-_ENVIRON_HEADERS = {
- 'auth_token': ['HTTP_X_AUTH_TOKEN',
- 'HTTP_X_STORAGE_TOKEN'],
- 'user_id': ['HTTP_X_USER_ID',
- 'HTTP_X_USER'],
- 'project_id': ['HTTP_X_PROJECT_ID',
- 'HTTP_X_TENANT_ID',
- 'HTTP_X_TENANT'],
+_ENVIRON_HEADERS: ty.Dict[str, ty.List[str]] = {
+ 'auth_token': ['HTTP_X_AUTH_TOKEN', 'HTTP_X_STORAGE_TOKEN'],
+ 'user_id': ['HTTP_X_USER_ID', 'HTTP_X_USER'],
+ 'project_id': ['HTTP_X_PROJECT_ID', 'HTTP_X_TENANT_ID', 'HTTP_X_TENANT'],
'domain_id': ['HTTP_X_DOMAIN_ID'],
'system_scope': ['HTTP_OPENSTACK_SYSTEM_SCOPE'],
'user_domain_id': ['HTTP_X_USER_DOMAIN_ID'],
'project_domain_id': ['HTTP_X_PROJECT_DOMAIN_ID'],
'user_name': ['HTTP_X_USER_NAME'],
- 'project_name': ['HTTP_X_PROJECT_NAME',
- 'HTTP_X_TENANT_NAME'],
+ 'project_name': ['HTTP_X_PROJECT_NAME', 'HTTP_X_TENANT_NAME'],
'user_domain_name': ['HTTP_X_USER_DOMAIN_NAME'],
'project_domain_name': ['HTTP_X_PROJECT_DOMAIN_NAME'],
'request_id': ['openstack.request_id'],
'global_request_id': ['openstack.global_request_id'],
-
'service_token': ['HTTP_X_SERVICE_TOKEN'],
'service_user_id': ['HTTP_X_SERVICE_USER_ID'],
'service_user_name': ['HTTP_X_SERVICE_USER_NAME'],
@@ -74,7 +69,7 @@
}
-def generate_request_id():
+def generate_request_id() -> str:
"""Generate a unique request id."""
return 'req-%s' % uuid.uuid4()
@@ -87,11 +82,11 @@
these values as oslo.policy will do will trigger a DeprecationWarning.
"""
- def __init__(self, data):
+ def __init__(self, data: ty.Dict[str, ty.Any]):
self._data = data
- self._deprecated = {}
+ self._deprecated: ty.Dict[str, ty.Any] = {}
- def __getitem__(self, k):
+ def __getitem__(self, k: str) -> ty.Any:
try:
return self._data[k]
except KeyError:
@@ -110,32 +105,33 @@
raise KeyError(k)
- def __setitem__(self, k, v):
+ def __setitem__(self, k: str, v: ty.Any) -> None:
self._deprecated[k] = v
- def __delitem__(self, k):
+ def __delitem__(self, k: str) -> None:
del self._deprecated[k]
- def __iter__(self):
+ def __iter__(self) -> ty.Iterator[ty.Any]:
return iter(self._dict)
- def __len__(self):
+ def __len__(self) -> int:
return len(self._dict)
- def __str__(self):
+ def __str__(self) -> str:
return self._dict.__str__()
- def __repr__(self):
+ def __repr__(self) -> str:
return self._dict.__repr__()
@property
- def _dict(self):
+ def _dict(self) -> ty.Dict[str, ty.Any]:
d = self._deprecated.copy()
d.update(self._data)
return d
-def _moved_msg(new_name, old_name):
+# TODO(stephenfin): Remove this in the 4.0 release
+def _moved_msg(new_name: str, old_name: ty.Optional[str]) -> None:
if old_name:
deprecated_msg = "Property '%(old_name)s' has moved to '%(new_name)s'"
deprecated_msg = deprecated_msg % {'old_name': old_name,
@@ -147,22 +143,23 @@
stacklevel=5)
-def _moved_property(new_name, old_name=None, target=None):
-
- if not target:
- target = new_name
+def _moved_property(
+ new_name: str,
+ old_name: ty.Optional[str] = None,
+ target: ty.Optional[str] = None,
+) -> ty.Any:
- def getter(self):
+ def getter(self: ty.Any) -> ty.Any:
_moved_msg(new_name, old_name)
- return getattr(self, target)
+ return getattr(self, target or new_name)
- def setter(self, value):
+ def setter(self: ty.Any, value: str) -> None:
_moved_msg(new_name, old_name)
- setattr(self, target, value)
+ setattr(self, target or new_name, value)
- def deleter(self):
+ def deleter(self: ty.Any) -> None:
_moved_msg(new_name, old_name)
- delattr(self, target)
+ delattr(self, target or new_name)
return property(getter, setter, deleter)
@@ -181,48 +178,49 @@
accesses the system, as well as additional request information.
"""
- user_idt_format = u'{user} {tenant} {domain} {user_domain} {p_domain}'
+ user_idt_format = '{user} {project_id} {domain} {user_domain} {p_domain}'
# Can be overridden in subclasses to specify extra keys that should be
# read when constructing a context using from_dict.
- FROM_DICT_EXTRA_KEYS = []
+ FROM_DICT_EXTRA_KEYS: ty.List[str] = []
@_renamed_kwarg('user', 'user_id')
- @_renamed_kwarg('tenant', 'project_id')
@_renamed_kwarg('domain', 'domain_id')
@_renamed_kwarg('user_domain', 'user_domain_id')
@_renamed_kwarg('project_domain', 'project_domain_id')
- def __init__(self,
- auth_token=None,
- user_id=None,
- project_id=None,
- domain_id=None,
- user_domain_id=None,
- project_domain_id=None,
- is_admin=False,
- read_only=False,
- show_deleted=False,
- request_id=None,
- resource_uuid=None,
- overwrite=True,
- roles=None,
- user_name=None,
- project_name=None,
- domain_name=None,
- user_domain_name=None,
- project_domain_name=None,
- is_admin_project=True,
- service_token=None,
- service_user_id=None,
- service_user_name=None,
- service_user_domain_id=None,
- service_user_domain_name=None,
- service_project_id=None,
- service_project_name=None,
- service_project_domain_id=None,
- service_project_domain_name=None,
- service_roles=None,
- global_request_id=None,
- system_scope=None):
+ def __init__(
+ self,
+ auth_token: ty.Optional[str] = None,
+ user_id: ty.Optional[str] = None,
+ project_id: ty.Optional[str] = None,
+ domain_id: ty.Optional[str] = None,
+ user_domain_id: ty.Optional[str] = None,
+ project_domain_id: ty.Optional[str] = None,
+ is_admin: bool = False,
+ read_only: bool = False,
+ show_deleted: bool = False,
+ request_id: ty.Optional[str] = None,
+ resource_uuid: ty.Optional[str] = None,
+ overwrite: bool = True,
+ roles: ty.Optional[ty.List[str]] = None,
+ user_name: ty.Optional[str] = None,
+ project_name: ty.Optional[str] = None,
+ domain_name: ty.Optional[str] = None,
+ user_domain_name: ty.Optional[str] = None,
+ project_domain_name: ty.Optional[str] = None,
+ is_admin_project: bool = True,
+ service_token: ty.Optional[str] = None,
+ service_user_id: ty.Optional[str] = None,
+ service_user_name: ty.Optional[str] = None,
+ service_user_domain_id: ty.Optional[str] = None,
+ service_user_domain_name: ty.Optional[str] = None,
+ service_project_id: ty.Optional[str] = None,
+ service_project_name: ty.Optional[str] = None,
+ service_project_domain_id: ty.Optional[str] = None,
+ service_project_domain_name: ty.Optional[str] = None,
+ service_roles: ty.Optional[ty.List[str]] = None,
+ global_request_id: ty.Optional[str] = None,
+ system_scope: ty.Optional[str] = None,
+ ):
"""Initialize the RequestContext
:param overwrite: Set to False to ensure that the greenthread local
@@ -277,17 +275,14 @@
self.update_store()
# NOTE(jamielennox): To prevent circular lookups on subclasses that might
- # point user to user_id we make user/user_id tenant/project_id etc point
+ # point user to user_id we make user/user_id etc point
# to the same private variable rather than each other.
- tenant = _moved_property('project_id', 'tenant', target='_project_id')
user = _moved_property('user_id', 'user', target='_user_id')
domain = _moved_property('domain_id', 'domain', target='_domain_id')
- user_domain = _moved_property('user_domain_id',
- 'user_domain',
- target='_user_domain_id')
- project_domain = _moved_property('project_domain_id',
- 'project_domain',
- target='_project_domain_id')
+ user_domain = _moved_property(
+ 'user_domain_id', 'user_domain', target='_user_domain_id')
+ project_domain = _moved_property(
+ 'project_domain_id', 'project_domain', target='_project_domain_id')
user_id = _moved_property('_user_id')
project_id = _moved_property('_project_id')
@@ -295,11 +290,11 @@
user_domain_id = _moved_property('_user_domain_id')
project_domain_id = _moved_property('_project_domain_id')
- def update_store(self):
+ def update_store(self) -> None:
"""Store the context in the current thread."""
_request_store.context = self
- def to_policy_values(self):
+ def to_policy_values(self) -> _DeprecatedPolicyValues:
"""A dictionary of context attributes to enforce policy with.
oslo.policy enforcement requires a dictionary of attributes
@@ -328,19 +323,21 @@
'service_user_domain_id': self.service_user_domain_id,
'service_project_id': self.service_project_id,
'service_project_domain_id': self.service_project_domain_id,
- 'service_roles': self.service_roles})
+ 'service_roles': self.service_roles,
+ })
- def to_dict(self):
+ def to_dict(self) -> ty.Dict[str, ty.Any]:
"""Return a dictionary of context attributes."""
user_idt = self.user_idt_format.format(
user=self.user_id or '-',
- tenant=self.project_id or '-',
+ project_id=self.project_id or '-',
domain=self.domain_id or '-',
user_domain=self.user_domain_id or '-',
- p_domain=self.project_domain_id or '-')
+ p_domain=self.project_domain_id or '-',
+ )
return {'user': self.user_id,
- 'tenant': self.project_id,
+ 'project_id': self.project_id,
'system_scope': self.system_scope,
'project': self.project_id,
'domain': self.domain_id,
@@ -357,7 +354,7 @@
'user_identity': user_idt,
'is_admin_project': self.is_admin_project}
- def get_logging_values(self):
+ def get_logging_values(self) -> ty.Dict[str, ty.Any]:
"""Return a dictionary of logging specific context attributes."""
values = {'user_name': self.user_name,
'project_name': self.project_name,
@@ -381,7 +378,7 @@
return values
@property
- def global_id(self):
+ def global_id(self) -> str:
"""Return a sensible value for global_id to pass on.
When we want to make a call with to another service, it's
@@ -392,15 +389,16 @@
@classmethod
@_renamed_kwarg('user', 'user_id')
- @_renamed_kwarg('tenant', 'project_id')
@_renamed_kwarg('domain', 'domain_id')
@_renamed_kwarg('user_domain', 'user_domain_id')
@_renamed_kwarg('project_domain', 'project_domain_id')
- def from_dict(cls, values, **kwargs):
+ def from_dict(
+ cls, values: ty.Dict[str, ty.Any], **kwargs: ty.Any,
+ ) -> 'RequestContext':
"""Construct a context object from a provided dictionary."""
kwargs.setdefault('auth_token', values.get('auth_token'))
kwargs.setdefault('user_id', values.get('user'))
- kwargs.setdefault('project_id', values.get('tenant'))
+ kwargs.setdefault('project_id', values.get('project_id'))
kwargs.setdefault('domain_id', values.get('domain'))
kwargs.setdefault('user_domain_id', values.get('user_domain'))
kwargs.setdefault('project_domain_id', values.get('project_domain'))
@@ -419,17 +417,19 @@
values.get('project_domain_name'))
kwargs.setdefault('is_admin_project',
values.get('is_admin_project', True))
+ kwargs.setdefault('system_scope', values.get('system_scope'))
for key in cls.FROM_DICT_EXTRA_KEYS:
kwargs.setdefault(key, values.get(key))
return cls(**kwargs)
@classmethod
@_renamed_kwarg('user', 'user_id')
- @_renamed_kwarg('tenant', 'project_id')
@_renamed_kwarg('domain', 'domain_id')
@_renamed_kwarg('user_domain', 'user_domain_id')
@_renamed_kwarg('project_domain', 'project_domain_id')
- def from_environ(cls, environ, **kwargs):
+ def from_environ(
+ cls, environ: ty.Dict[str, ty.Any], **kwargs: ty.Any,
+ ) -> 'RequestContext':
"""Load a context object from a request environment.
If keyword arguments are provided then they override the values in the
@@ -472,7 +472,7 @@
return cls(**kwargs)
-def get_admin_context(show_deleted=False):
+def get_admin_context(show_deleted: bool = False) -> RequestContext:
"""Create an administrator context."""
context = RequestContext(None,
project_id=None,
@@ -482,13 +482,16 @@
return context
-def get_context_from_function_and_args(function, args, kwargs):
+def get_context_from_function_and_args(
+ function: ty.Callable,
+ args: ty.List[ty.Any],
+ kwargs: ty.Dict[str, ty.Any],
+) -> ty.Optional[RequestContext]:
"""Find an arg of type RequestContext and return it.
- This is useful in a couple of decorators where we don't
- know much about the function we're wrapping.
+ This is useful in a couple of decorators where we don't know much about the
+ function we're wrapping.
"""
-
for arg in itertools.chain(kwargs.values(), args):
if isinstance(arg, RequestContext):
return arg
@@ -496,7 +499,7 @@
return None
-def is_user_context(context):
+def is_user_context(context: RequestContext) -> bool:
"""Indicates if the request context is a normal user."""
if not context or not isinstance(context, RequestContext):
return False
@@ -505,7 +508,7 @@
return True
-def get_current():
+def get_current() -> ty.Optional[RequestContext]:
"""Return this thread's current context
If no context is set, returns None
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/oslo.context-3.3.1/oslo_context/fixture.py
new/oslo.context-4.1.0/oslo_context/fixture.py
--- old/oslo.context-3.3.1/oslo_context/fixture.py 2021-08-19
14:36:52.000000000 +0200
+++ new/oslo.context-4.1.0/oslo_context/fixture.py 2022-02-16
19:48:48.000000000 +0100
@@ -24,7 +24,7 @@
run later in the same process.
"""
- def setUp(self):
+ def setUp(self) -> None:
super(ClearRequestContext, self).setUp()
# we need to clear both when we start, and when we finish,
# because there might be other tests running that don't handle
@@ -32,7 +32,7 @@
self._remove_cached_context()
self.addCleanup(self._remove_cached_context)
- def _remove_cached_context(self):
+ def _remove_cached_context(self) -> None:
"""Remove the thread-local context stored in the module."""
try:
del context._request_store.context
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/oslo.context-3.3.1/oslo_context/tests/test_context.py
new/oslo.context-4.1.0/oslo_context/tests/test_context.py
--- old/oslo.context-3.3.1/oslo_context/tests/test_context.py 2021-08-19
14:36:52.000000000 +0200
+++ new/oslo.context-4.1.0/oslo_context/tests/test_context.py 2022-02-16
19:48:48.000000000 +0100
@@ -129,7 +129,7 @@
"auth_token": "token1",
"user": "user1",
"user_name": "user1_name",
- "tenant": "tenant1",
+ "project_id": "tenant1",
"project_name": "tenant1_name",
"domain": "domain1",
"domain_name": "domain1_name",
@@ -143,12 +143,13 @@
"request_id": "request1",
"global_request_id": "req-uuid",
"resource_uuid": "instance1",
- "extra_data": "foo"
+ "extra_data": "foo",
+ "system_scope": "all"
}
ctx = context.RequestContext.from_dict(dct)
self.assertEqual(dct['auth_token'], ctx.auth_token)
self.assertEqual(dct['user'], ctx.user_id)
- self.assertEqual(dct['tenant'], ctx.project_id)
+ self.assertEqual(dct['project_id'], ctx.project_id)
self.assertEqual(dct['domain'], ctx.domain_id)
self.assertEqual(dct['user_domain'], ctx.user_domain_id)
self.assertEqual(dct['project_domain'], ctx.project_domain_id)
@@ -163,6 +164,7 @@
self.assertEqual(dct['domain_name'], ctx.domain_name)
self.assertEqual(dct['user_domain_name'], ctx.user_domain_name)
self.assertEqual(dct['project_domain_name'], ctx.project_domain_name)
+ self.assertEqual(dct['system_scope'], ctx.system_scope)
def test_from_dict_unknown_keys(self):
dct = {
@@ -196,7 +198,7 @@
self.assertEqual("token1", ctx.auth_token)
self.assertEqual("user2", ctx.user)
self.assertEqual("project1", ctx.project_name)
- self.assertIsNone(ctx.tenant)
+ self.assertIsNone(ctx.project_id)
self.assertFalse(ctx.is_admin)
self.assertTrue(ctx.read_only)
@@ -320,7 +322,7 @@
environ = {'HTTP_X_TENANT': value}
ctx = context.RequestContext.from_environ(environ=environ)
- self.assertEqual(value, ctx.tenant)
+ self.assertEqual(value, ctx.project_id)
environ = {'HTTP_X_ROLE': value}
ctx = context.RequestContext.from_environ(environ=environ)
@@ -352,7 +354,7 @@
self.assertEqual(new, ctx.project_id)
ctx = context.RequestContext.from_environ(environ=environ,
- tenant=override)
+ project_id=override)
self.assertEqual(override, ctx.project_id)
environ = {'HTTP_X_TENANT_NAME': old,
@@ -422,7 +424,7 @@
ctx = context.RequestContext(auth_token=auth_token,
user=user_id,
user_name=user_name,
- tenant=project_id,
+ project_id=project_id,
project_name=project_name,
domain=domain_id,
domain_name=domain_name,
@@ -456,7 +458,7 @@
d = ctx.to_dict()
self.assertIn('auth_token', d)
self.assertIn('user', d)
- self.assertIn('tenant', d)
+ self.assertIn('project_id', d)
self.assertIn('domain', d)
self.assertIn('user_domain', d)
self.assertIn('project_domain', d)
@@ -474,7 +476,7 @@
self.assertNotIn('project_domain_name', d)
self.assertEqual(auth_token, d['auth_token'])
- self.assertEqual(project_id, d['tenant'])
+ self.assertEqual(project_id, d['project_id'])
self.assertEqual(domain_id, d['domain'])
self.assertEqual(user_domain_id, d['user_domain'])
self.assertEqual(project_domain_id, d['project_domain'])
@@ -492,7 +494,7 @@
self.assertIn('auth_token', d)
self.assertEqual(d['auth_token'], '***')
self.assertIn('user', d)
- self.assertIn('tenant', d)
+ self.assertIn('project_id', d)
self.assertIn('domain', d)
self.assertIn('user_domain', d)
self.assertIn('project_domain', d)
@@ -544,7 +546,7 @@
def test_policy_dict(self):
user = uuid.uuid4().hex
user_domain = uuid.uuid4().hex
- tenant = uuid.uuid4().hex
+ project_id = uuid.uuid4().hex
project_domain = uuid.uuid4().hex
roles = [uuid.uuid4().hex, uuid.uuid4().hex, uuid.uuid4().hex]
service_user_id = uuid.uuid4().hex
@@ -554,7 +556,7 @@
# default is_admin_project is True
ctx = context.RequestContext(user=user,
user_domain=user_domain,
- tenant=tenant,
+ project_id=project_id,
project_domain=project_domain,
roles=roles,
service_user_id=service_user_id,
@@ -565,7 +567,7 @@
'user_domain_id': user_domain,
'system_scope': None,
'domain_id': None,
- 'project_id': tenant,
+ 'project_id': project_id,
'project_domain_id': project_domain,
'roles': roles,
'is_admin_project': True,
@@ -630,7 +632,7 @@
ctx = context.RequestContext(user=user,
user_domain=user_domain,
- tenant=tenant,
+ project_id=project_id,
project_domain=project_domain,
roles=roles,
is_admin_project=False,
@@ -642,7 +644,7 @@
'user_domain_id': user_domain,
'system_scope': None,
'domain_id': None,
- 'project_id': tenant,
+ 'project_id': project_id,
'project_domain_id': project_domain,
'roles': roles,
'is_admin_project': False,
@@ -656,13 +658,13 @@
def test_policy_deprecations(self):
user = uuid.uuid4().hex
user_domain = uuid.uuid4().hex
- tenant = uuid.uuid4().hex
+ project_id = uuid.uuid4().hex
project_domain = uuid.uuid4().hex
roles = [uuid.uuid4().hex, uuid.uuid4().hex, uuid.uuid4().hex]
ctx = context.RequestContext(user=user,
user_domain=user_domain,
- tenant=tenant,
+ project_id=project_id,
project_domain=project_domain,
roles=roles)
@@ -705,11 +707,9 @@
self.assertEqual(0, len(self.warnings))
self.assertEqual(user_id, ctx.user)
self.assertEqual(1, len(self.warnings))
- self.assertEqual(project_id, ctx.tenant)
- self.assertEqual(2, len(self.warnings))
self.assertEqual(domain_id, ctx.domain)
- self.assertEqual(3, len(self.warnings))
+ self.assertEqual(2, len(self.warnings))
self.assertEqual(user_domain_id, ctx.user_domain)
- self.assertEqual(4, len(self.warnings))
+ self.assertEqual(3, len(self.warnings))
self.assertEqual(project_domain_id, ctx.project_domain)
- self.assertEqual(5, len(self.warnings))
+ self.assertEqual(4, len(self.warnings))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/oslo.context-3.3.1/oslo_context/version.py
new/oslo.context-4.1.0/oslo_context/version.py
--- old/oslo.context-3.3.1/oslo_context/version.py 2021-08-19
14:36:52.000000000 +0200
+++ new/oslo.context-4.1.0/oslo_context/version.py 2022-02-16
19:48:48.000000000 +0100
@@ -12,7 +12,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-
import pbr.version
version_info = pbr.version.VersionInfo('oslo.context')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/oslo.context-3.3.1/releasenotes/notes/Fix-system-scope-from_dict-29615af90723ba4d.yaml
new/oslo.context-4.1.0/releasenotes/notes/Fix-system-scope-from_dict-29615af90723ba4d.yaml
---
old/oslo.context-3.3.1/releasenotes/notes/Fix-system-scope-from_dict-29615af90723ba4d.yaml
1970-01-01 01:00:00.000000000 +0100
+++
new/oslo.context-4.1.0/releasenotes/notes/Fix-system-scope-from_dict-29615af90723ba4d.yaml
2022-02-16 19:48:48.000000000 +0100
@@ -0,0 +1,4 @@
+---
+fixes:
+ - |
+ Fixes context from_dict() to properly handle system_scope.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/oslo.context-3.3.1/releasenotes/notes/remove_deprecated_args_tenant-77724de1422f46d9.yaml
new/oslo.context-4.1.0/releasenotes/notes/remove_deprecated_args_tenant-77724de1422f46d9.yaml
---
old/oslo.context-3.3.1/releasenotes/notes/remove_deprecated_args_tenant-77724de1422f46d9.yaml
1970-01-01 01:00:00.000000000 +0100
+++
new/oslo.context-4.1.0/releasenotes/notes/remove_deprecated_args_tenant-77724de1422f46d9.yaml
2022-02-16 19:48:48.000000000 +0100
@@ -0,0 +1,5 @@
+---
+upgrade:
+ - |
+ The ``tenant`` argument of ``RequestContext`` that was deprecated for
+ long time is now removed.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/oslo.context-3.3.1/releasenotes/source/index.rst
new/oslo.context-4.1.0/releasenotes/source/index.rst
--- old/oslo.context-3.3.1/releasenotes/source/index.rst 2021-08-19
14:36:52.000000000 +0200
+++ new/oslo.context-4.1.0/releasenotes/source/index.rst 2022-02-16
19:48:48.000000000 +0100
@@ -6,6 +6,7 @@
:maxdepth: 1
unreleased
+ xena
wallaby
victoria
ussuri
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/oslo.context-3.3.1/releasenotes/source/xena.rst
new/oslo.context-4.1.0/releasenotes/source/xena.rst
--- old/oslo.context-3.3.1/releasenotes/source/xena.rst 1970-01-01
01:00:00.000000000 +0100
+++ new/oslo.context-4.1.0/releasenotes/source/xena.rst 2022-02-16
19:48:48.000000000 +0100
@@ -0,0 +1,6 @@
+=========================
+Xena Series Release Notes
+=========================
+
+.. release-notes::
+ :branch: stable/xena
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/oslo.context-3.3.1/setup.cfg
new/oslo.context-4.1.0/setup.cfg
--- old/oslo.context-3.3.1/setup.cfg 2021-08-19 14:38:39.219790200 +0200
+++ new/oslo.context-4.1.0/setup.cfg 2022-02-16 19:49:28.691795000 +0100
@@ -25,6 +25,17 @@
packages =
oslo_context
+[mypy]
+show_column_numbers = true
+show_error_context = true
+ignore_missing_imports = true
+check_untyped_defs = true
+warn_unused_ignores = true
+disallow_untyped_defs = true
+
+[mypy-oslo_context.tests.*]
+ignore_errors = true
+
[egg_info]
tag_build =
tag_date = 0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/oslo.context-3.3.1/test-requirements.txt
new/oslo.context-4.1.0/test-requirements.txt
--- old/oslo.context-3.3.1/test-requirements.txt 2021-08-19
14:36:52.000000000 +0200
+++ new/oslo.context-4.1.0/test-requirements.txt 2022-02-16
19:48:48.000000000 +0100
@@ -3,6 +3,7 @@
# process, which may cause wedges in the gate later.
hacking>=3.0.1,<3.1.0 # Apache-2.0
+mypy>=0.761 # MIT
fixtures>=3.0.0 # Apache-2.0/BSD
oslotest>=3.2.0 # Apache-2.0
coverage!=4.4,>=4.0 # Apache-2.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/oslo.context-3.3.1/tox.ini
new/oslo.context-4.1.0/tox.ini
--- old/oslo.context-3.3.1/tox.ini 2021-08-19 14:36:52.000000000 +0200
+++ new/oslo.context-4.1.0/tox.ini 2022-02-16 19:48:48.000000000 +0100
@@ -5,32 +5,48 @@
[testenv]
basepython = python3
+# TODO(damani): Drop distutils override once logging improves in setuptools
+# https://github.com/pypa/setuptools/issues/3038
+setenv =
+ SETUPTOOLS_USE_DISTUTILS=stdlib
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/test-requirements.txt
commands = stestr run --slowest {posargs}
+[testenv:mypy]
+description =
+ Run type checks.
+envdir = {toxworkdir}/shared
+commands =
+ python -m mypy {posargs:.}
+
[testenv:pep8]
-deps = {[testenv]deps}
+envdir = {toxworkdir}/shared
commands =
pre-commit run -a
# Run security linter
bandit -r oslo_context -x tests -n5
[testenv:venv]
+envdir = {toxworkdir}/shared
commands = {posargs}
[testenv:docs]
-whitelist_externals = rm
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/doc/requirements.txt
+whitelist_externals = rm
commands =
rm -fr doc/build
sphinx-build -W --keep-going -b html doc/source doc/build/html
[testenv:cover]
+# TODO(damani): Drop distutils override once logging improves in setuptools
+# https://github.com/pypa/setuptools/issues/3038
+envdir = {toxworkdir}/shared
setenv =
+ SETUPTOOLS_USE_DISTUTILS=stdlib
PYTHON=coverage run --source oslo_context --parallel-mode
commands =
stestr run {posargs}
@@ -48,6 +64,7 @@
import_exceptions =
[testenv:releasenotes]
+envdir = {toxworkdir}/docs
whitelist_externals = rm
deps = {[testenv:docs]deps}
commands =