From: Ondrej Lichtner <olichtne(a)redhat.com>
This commit fixes the use of function set_fail in several places in the
NetTestCommand module. These changes were overlooked when the change in
result reporting happened, sorry for that...
For ExecCmd the message that was previously there was removed as we
agreed on the meeting. The stderr report log was moved into debug logs
as well.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst/Common/ExecCmd.py | 2 +-
lnst/Common/NetTestCommand.py | 9 ++++++---
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/lnst/Common/ExecCmd.py b/lnst/Common/ExecCmd.py
index 174ea39..31f3759 100644
--- a/lnst/Common/ExecCmd.py
+++ b/lnst/Common/ExecCmd.py
@@ -61,7 +61,7 @@ def exec_cmd(cmd, die_on_err=True, log_outputs=True,
report_stderr=False):
if data_stdout:
log_output(logging.debug, "Stdout", data_stdout)
if data_stderr:
- log_output(logging.error, "Stderr", data_stderr)
+ log_output(logging.debug, "Stderr", data_stderr)
if subp.returncode and die_on_err:
err = ExecCmdFail(cmd, subp.returncode, data_stderr,report_stderr)
logging.error(err)
diff --git a/lnst/Common/NetTestCommand.py b/lnst/Common/NetTestCommand.py
index d6f6f0f..965f675 100644
--- a/lnst/Common/NetTestCommand.py
+++ b/lnst/Common/NetTestCommand.py
@@ -378,7 +378,7 @@ class NetTestCommandExec(NetTestCommandGeneric):
logging.info("Command probably intentionally killed.
Passing.")
self.set_pass()
else:
- self.set_fail("Command failed to execute")
+ self.set_fail()
def _format_cmd_res_header(self):
cmd_type = self._command["type"]
@@ -413,14 +413,17 @@ class NetTestCommandConfig(NetTestCommandGeneric):
option_abspath[0:6] != "/proc/":
err = "Wrong config option %s. Only /proc or /sys paths are "
\
"allowed." % option
- self.set_fail(err)
+ res_data = {"msg": err}
+ self.set_fail(res_data)
return
try:
prev_val = self._retrive_option(option)
self._set_option(option, value)
except ExecCmdFail:
- self.set_fail("Unable to set %s config option!" % option)
+ err = "Unable to set %s config option!" % option
+ res_data = {"msg": err}
+ self.set_fail(res_data)
return
if "persistent" in self._command:
--
1.8.3.1
Show replies by date