From 8873f5eb9146446c9772cee071632e623b7c405d Mon Sep 17 00:00:00 2001 From: "John L. Villalovos" Date: Thu, 1 Feb 2018 15:15:00 -0800 Subject: [PATCH] Replace use of functools.wraps() with six.wraps() In Python 2.7, functools.wraps() does not provide the '__wrapped__' attribute. This attribute is used by oslo_utils.reflection.get_signature() when getting the signature of a function. If a function is decorated without the '__wrapped__' attribute then the signature will be of the decorator rather than the underlying function. From the six documentation for six.wraps(): This is exactly the functools.wraps() decorator, but it sets the __wrapped__ attribute on what it decorates as functools.wraps() does on Python versions after 3.2. Change-Id: Ic0f7a6be9bc3e474a0229b264d1bfe6c8f7e6d85 --- ironic_python_agent/extensions/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ironic_python_agent/extensions/base.py b/ironic_python_agent/extensions/base.py index b026dece8..a23e2f315 100644 --- a/ironic_python_agent/extensions/base.py +++ b/ironic_python_agent/extensions/base.py @@ -282,7 +282,7 @@ def async_command(command_name, validator=None): def async_decorator(func): func.command_name = command_name - @functools.wraps(func) + @six.wraps(func) def wrapper(self, **command_params): # Run a validator before passing everything off to async. # validators should raise exceptions or return silently. @@ -311,7 +311,7 @@ def sync_command(command_name, validator=None): def sync_decorator(func): func.command_name = command_name - @functools.wraps(func) + @six.wraps(func) def wrapper(self, **command_params): # Run a validator before invoking the function. # validators should raise exceptions or return silently.