On Wed, Jul 08, 2015 at 05:28:43PM +0200, 'Klaus Aehlig' via ganeti-devel wrote:
...so that it can be used outside the filter test as well.
Signed-off-by: Klaus Aehlig <[email protected]>
---
qa/qa_filters.py | 15 +--------------
qa/qa_job_utils.py | 2 +-
qa/qa_utils.py | 13 +++++++++++++
3 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/qa/qa_filters.py b/qa/qa_filters.py
index 624f107..3f41120 100644
--- a/qa/qa_filters.py
+++ b/qa/qa_filters.py
@@ -39,20 +39,7 @@ from ganeti.utils import retry
import qa_job_utils
import qa_utils
-from qa_utils import AssertCommand, AssertEqual, AssertIn
-
-
-def stdout_of(cmd):
- """Small helper to run a stdout_of.
- Makes sure the stdout_of returns exit code 0.
-
- @type cmd: list of strings
- @param cmd: the stdout_of to run
-
- @return: Captured, stripped stdout.
- """
- _, out, _ = AssertCommand(cmd)
- return out.strip()
+from qa_utils import AssertCommand, AssertEqual, AssertIn, stdout_of
def GetJobStatus(job_id):
diff --git a/qa/qa_job_utils.py b/qa/qa_job_utils.py
index 988b5f0..23ff206 100644
--- a/qa/qa_job_utils.py
+++ b/qa/qa_job_utils.py
@@ -46,7 +46,7 @@ import qa_config
import qa_logging
import qa_error
-from qa_utils import AssertCommand, GetCommandOutput, GetObjectInfo
+from qa_utils import AssertCommand, GetCommandOutput, GetObjectInfo, stdout_of
AVAILABLE_LOCKS = [locking.LEVEL_NODE, ]
diff --git a/qa/qa_utils.py b/qa/qa_utils.py
index e7daf1b..89609c7 100644
--- a/qa/qa_utils.py
+++ b/qa/qa_utils.py
@@ -225,6 +225,19 @@ def AssertCommand(cmd, fail=False, node=None,
log_cmd=True, max_seconds=None):
return rcode, stdout, stderr
+def stdout_of(cmd):
+ """Small helper to run a stdout_of.
+ Makes sure the stdout_of returns exit code 0.
+
+ @type cmd: list of strings
+ @param cmd: the stdout_of to run
+
+ @return: Captured, stripped stdout.
+ """
+ _, out, _ = AssertCommand(cmd)
+ return out.strip()
+
+
def AssertRedirectedCommand(cmd, fail=False, node=None, log_cmd=True):
"""Executes a command with redirected output.
--
2.4.3.573.g4eafbef
LGTM