SHA256
1
0
forked from pool/salt
salt/path-replace-functools.wraps-with-six.wraps-bsc-1177.patch

55 lines
1.7 KiB
Diff

From 9707eab7452a94e64f77ece707c31c37e43e47f2 Mon Sep 17 00:00:00 2001
From: Alberto Planas <aplanas@suse.com>
Date: Tue, 20 Oct 2020 13:13:24 +0200
Subject: [PATCH] path: replace functools.wraps with six.wraps
(bsc#1177867) (#283)
Python 2.7 functools.wraps decorator do not add the `__wrapped__`
attribute to decorated functions, that is used by Salt to access the
original function and deduce the parameters from the signature.
This patch uses six.wraps, that add this extra attribute.
---
salt/utils/decorators/path.py | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/salt/utils/decorators/path.py b/salt/utils/decorators/path.py
index 8ee7fb1d11..a763c92d22 100644
--- a/salt/utils/decorators/path.py
+++ b/salt/utils/decorators/path.py
@@ -4,11 +4,10 @@ Decorators for salt.utils.path
'''
from __future__ import absolute_import, print_function, unicode_literals
-import functools
-
# Import Salt libs
import salt.utils.path
from salt.exceptions import CommandNotFoundError
+import salt.ext.six
def which(exe):
@@ -16,7 +15,7 @@ def which(exe):
Decorator wrapper for salt.utils.path.which
'''
def wrapper(function):
- @functools.wraps(function)
+ @salt.ext.six.wraps(function)
def wrapped(*args, **kwargs):
if salt.utils.path.which(exe) is None:
raise CommandNotFoundError(
@@ -34,7 +33,7 @@ def which_bin(exes):
Decorator wrapper for salt.utils.path.which_bin
'''
def wrapper(function):
- @functools.wraps(function)
+ @salt.ext.six.wraps(function)
def wrapped(*args, **kwargs):
if salt.utils.path.which_bin(exes) is None:
raise CommandNotFoundError(
--
2.28.0