Add a param( default raise_error = True) in run function, thus when virsh
  command gets a wrong param and  isnt't expected to raise error, we can
  set raise_error = False.

Signed-off-by: Gu Yanhua <[email protected]>
---
  client/shared/base_utils.py |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/client/shared/base_utils.py b/client/shared/base_utils.py
index 8e38413..914f7ab 100644
--- a/client/shared/base_utils.py
+++ b/client/shared/base_utils.py
@@ -744,7 +744,7 @@ def get_stderr_level(stderr_is_expected):

  def run(command, timeout=None, ignore_status=False,
          stdout_tee=None, stderr_tee=None, verbose=True, stdin=None,
-        stderr_is_expected=None, args=()):
+        stderr_is_expected=None, args=(), raise_error=True):
      """
      Run a command on the host.

@@ -783,7 +783,7 @@ def run(command, timeout=None, ignore_status=False,
          (BgJob(command, stdout_tee, stderr_tee, verbose, stdin=stdin,
                 stderr_level=get_stderr_level(stderr_is_expected)),),
          timeout)[0]
-    if not ignore_status and bg_job.result.exit_status:
+    if not ignore_status and bg_job.result.exit_status and raise_error:
          raise error.CmdError(command, bg_job.result,
                               "Command returned non-zero exit status")

--
1.7.1

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to