summaryrefslogtreecommitdiffstats
path: root/openshift-storage-libs/openshiftstoragelibs/podcmd.py
diff options
context:
space:
mode:
authorValerii Ponomarov <vponomar@redhat.com>2019-05-24 17:58:01 +0530
committervponomar <vponomar@redhat.com>2019-05-29 09:54:03 +0000
commitffdc9f4ea59131de97f8c41784ee6c79d654662f (patch)
tree5a935f0ff3d97d218c773c8529fbaecf81754ab1 /openshift-storage-libs/openshiftstoragelibs/podcmd.py
parent0e5dc8cd5053fd9fd3582221b1bd6c211a643778 (diff)
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
Diffstat (limited to 'openshift-storage-libs/openshiftstoragelibs/podcmd.py')
-rw-r--r--openshift-storage-libs/openshiftstoragelibs/podcmd.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/openshift-storage-libs/openshiftstoragelibs/podcmd.py b/openshift-storage-libs/openshiftstoragelibs/podcmd.py
index 1787bf3..83f49ca 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):