From ff040ada4f4d69f8b900f1da6ab81e0754dc76bb Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Tue, 26 Mar 2024 21:36:55 +0000 Subject: [PATCH] api: Don't do version check if nothing required There's no reason to inspect the API version requested (and reject things if unset) if we don't have version constraints on the API resource. This lets us add schema decorators to unversioned API resources (i.e. the "versions" API at '/'). Change-Id: Ib4d4585e3e4664eba8cd3daa47b4349eb2bfed74 Signed-off-by: Stephen Finucane --- nova/api/openstack/api_version_request.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nova/api/openstack/api_version_request.py b/nova/api/openstack/api_version_request.py index 841b2211f8..18355ae95b 100644 --- a/nova/api/openstack/api_version_request.py +++ b/nova/api/openstack/api_version_request.py @@ -389,10 +389,10 @@ class APIVersionRequest(object): If self is null then raise ValueError """ - if self.is_null(): - raise ValueError if max_version.is_null() and min_version.is_null(): return True + elif self.is_null(): + raise ValueError elif max_version.is_null(): return min_version <= self elif min_version.is_null():