Commit 57696dd6 authored by Klaus Aehlig's avatar Klaus Aehlig

Move stdout_of to qa_utils

...so that it can be used outside the filter test as well.
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarPetr Pudlak <pudlak@google.com>
parent 7f1ac87a
......@@ -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):
......
......@@ -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, ]
......
......@@ -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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment