From 91a5db818b7603c34f822a856e80fc82df03a35c Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Wed, 21 Feb 2024 11:03:27 +0000 Subject: [PATCH] api: Add missing functools.wraps To preserve function signature. Change-Id: I1238dff20d6fcce3e3c74b446b547052f297d8b5 Signed-off-by: Stephen Finucane --- cinder/api/contrib/hosts.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cinder/api/contrib/hosts.py b/cinder/api/contrib/hosts.py index ac8ba1c9aa8..8b86bbd37bc 100644 --- a/cinder/api/contrib/hosts.py +++ b/cinder/api/contrib/hosts.py @@ -15,6 +15,8 @@ """The hosts admin extension.""" +import functools + from oslo_config import cfg from oslo_log import log as logging from oslo_log import versionutils @@ -74,13 +76,14 @@ def _list_hosts(req, service=None): return hosts -def check_host(fn): +def check_host(f): """Makes sure that the host exists.""" + @functools.wraps(f) def wrapped(self, req, id, service=None, *args, **kwargs): listed_hosts = _list_hosts(req, service) hosts = [h["host_name"] for h in listed_hosts] if id in hosts: - return fn(self, req, id, *args, **kwargs) + return f(self, req, id, *args, **kwargs) raise exception.HostNotFound(host=id) return wrapped