diff options
author | John Mulligan <jmulligan@redhat.com> | 2018-01-03 14:40:38 -0500 |
---|---|---|
committer | John Mulligan <jmulligan@redhat.com> | 2018-01-10 10:50:21 -0500 |
commit | 0a48b5d2fb2dfde79e8117188863006ff2d8e849 (patch) | |
tree | 93544aec6c9ca86a2909ca0b42f39265227efa12 /cns-libs/cnslibs/common/openshift_ops.py | |
parent | 07b3da9c25f2907047402373273443eacbbd8c8b (diff) |
add a utility library to support patching glusto for pod support
This module provides the ability to patch the glusto run method
with the ability to run commands in pods. This module implements
the custom run method and a helper class that acts as a context
manager or decorator to patch glusto.
This version adds a log_level argument to oc_rsh in order to
plumb the argument all the way through to the inner glusto.run
method. It also cleans up some the docstrings and variable
names.
Change-Id: I0eeea234b1af5e60e41aae63e46e2d816e8929d2
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Diffstat (limited to 'cns-libs/cnslibs/common/openshift_ops.py')
-rw-r--r-- | cns-libs/cnslibs/common/openshift_ops.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/cns-libs/cnslibs/common/openshift_ops.py b/cns-libs/cnslibs/common/openshift_ops.py index beff3272..dbe89d0e 100644 --- a/cns-libs/cnslibs/common/openshift_ops.py +++ b/cns-libs/cnslibs/common/openshift_ops.py @@ -142,7 +142,7 @@ def switch_oc_project(ocp_node, project_name): return True -def oc_rsh(ocp_node, pod_name, command): +def oc_rsh(ocp_node, pod_name, command, log_level=None): """Run a command in the ocp pod using `oc rsh`. Args: @@ -150,6 +150,8 @@ def oc_rsh(ocp_node, pod_name, command): pod_name (str): Name of the pod on which the command will be executed. command (str|list): command to run. + log_level (str|None): log level to be passed to glusto's run + method. Returns: A tuple consisting of the command return code, stdout, and stderr. @@ -162,5 +164,5 @@ def oc_rsh(ocp_node, pod_name, command): # unpack the tuple to make sure our return value exactly matches # our docstring - ret, stdout, stderr = g.run(ocp_node, cmd) + ret, stdout, stderr = g.run(ocp_node, cmd, log_level=log_level) return (ret, stdout, stderr) |