summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn L. Villalovos <openstack.org@sodarock.com>2018-02-01 15:15:00 -0800
committerJohn L. Villalovos <openstack.org@sodarock.com>2018-02-01 15:15:00 -0800
commit8873f5eb9146446c9772cee071632e623b7c405d (patch)
treeb0624daab229cc09739fdf1a0b8926324ebabad3
parent7fa0e9f8c3efabe435614e54088a7d7ee7015dcf (diff)
downloadironic-python-agent-8873f5eb9146446c9772cee071632e623b7c405d.tar.gz
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
-rw-r--r--ironic_python_agent/extensions/base.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/ironic_python_agent/extensions/base.py b/ironic_python_agent/extensions/base.py
index b026dece..a23e2f31 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.