Merge "trivial: Fix logging issues"

This commit is contained in:
Zuul
2026-03-06 17:55:42 +00:00
committed by Gerrit Code Review
2 changed files with 11 additions and 15 deletions

View File

@@ -30,7 +30,6 @@ from oslo_versionedobjects._i18n import _
from oslo_versionedobjects import exception
from oslo_versionedobjects import fields as obj_fields
LOG = logging.getLogger('object')
@@ -386,12 +385,9 @@ class VersionedObject:
def obj_class_from_name(cls, objname, objver):
"""Returns a class from the registry based on a name and version."""
if objname not in VersionedObjectRegistry.obj_classes():
(
LOG.error(
'Unable to instantiate unregistered object type '
'%(objtype)s'
),
dict(objtype=objname),
LOG.error(
'Unable to instantiate unregistered object type %(objtype)s',
{'objtype': objname},
)
raise exception.UnsupportedObjectError(objtype=objname)

View File

@@ -385,14 +385,14 @@ class UUID(StringPattern):
# This is to ensure no breaking behaviour for current
# users
warnings.warn(
"{} is an invalid UUID. Using UUIDFields "
"with invalid UUIDs is no longer "
"supported, and will be removed in a future "
"release. Please update your "
"code to input valid UUIDs or accept "
"ValueErrors for invalid UUIDs. See "
"https://docs.openstack.org/oslo.versionedobjects/latest/reference/fields.html#oslo_versionedobjects.fields.UUIDField " # noqa
"for further details".format(repr(value).encode('utf8')),
f"{value!r} is an invalid UUID. Using UUIDFields "
f"with invalid UUIDs is no longer "
f"supported, and will be removed in a future "
f"release. Please update your "
f"code to input valid UUIDs or accept "
f"ValueErrors for invalid UUIDs. See "
f"https://docs.openstack.org/oslo.versionedobjects/latest/reference/fields.html#oslo_versionedobjects.fields.UUIDField " # noqa
f"for further details",
FutureWarning,
)