From ffdc9f4ea59131de97f8c41784ee6c79d654662f Mon Sep 17 00:00:00 2001 From: Valerii Ponomarov Date: Fri, 24 May 2019 17:58:01 +0530 Subject: Use 'cmd_run' func instead of 'g.run' func in openshift_ops.py It will allow us to recreate SSH connections when it is broken. Also, do following additional things: - Fix 'podcmd' module, where 'user' argument for 'g.run' is missing in it's wrapper. - Use "g.log.error" command to log errors when they appear inside of the 'cmd_run' func. - Delete several unused commands, instead of fixing them. - Update several test cases's logic due to the changes in the libraries. Change-Id: I908e5adcff739b6ab3a4aefaebfe46abdee22655 --- openshift-storage-libs/openshiftstoragelibs/podcmd.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'openshift-storage-libs/openshiftstoragelibs/podcmd.py') diff --git a/openshift-storage-libs/openshiftstoragelibs/podcmd.py b/openshift-storage-libs/openshiftstoragelibs/podcmd.py index 1787bf3c..83f49ca7 100644 --- a/openshift-storage-libs/openshiftstoragelibs/podcmd.py +++ b/openshift-storage-libs/openshiftstoragelibs/podcmd.py @@ -58,7 +58,7 @@ from openshiftstoragelibs import openshift_ops Pod = namedtuple('Pod', 'node podname') -def run(target, command, log_level=None, orig_run=g.run): +def run(target, command, user=None, log_level=None, orig_run=g.run): """Function that runs a command on a host or in a pod via a host. Wraps glusto's run function. @@ -73,8 +73,8 @@ def run(target, command, log_level=None, orig_run=g.run): If 'target' is of the 'Pod' type, then command will run on the specified POD. command (str|list): Command to run. - log_level (str|None): log level to be passed on to glusto's - run method + user (str|None): user to be passed on to glusto's run method + log_level (str|None): log level to be passed on to glusto's run method orig_run (function): The default implementation of the run method. Will be used when target is not a pod. @@ -102,9 +102,9 @@ def run(target, command, log_level=None, orig_run=g.run): # unpack the tuple to make sure our return value exactly matches # our docstring - return g.run(target.node, cmd, log_level=log_level) + return g.run(target.node, cmd, user=user, log_level=log_level) else: - return orig_run(target, command, log_level=log_level) + return orig_run(target, command, user=user, log_level=log_level) class GlustoPod(object): -- cgit