diff options
author | Shwetha-H-Panduranga <shwetha@gluster.com> | 2011-12-27 17:55:03 +0530 |
---|---|---|
committer | Shwetha-H-Panduranga <shwetha@gluster.com> | 2011-12-27 17:58:34 +0530 |
commit | 85fd40272633d7d4f5e142ac4b73d8f0ac3663db (patch) | |
tree | f36d86e814b1ea8fd2ac3a01adb76836e2ea6c6c | |
parent | 2b78067cde5ab3406edbdfb2677d7eb7f2f70f76 (diff) |
return 'output' dictionary from serverutils.execute_on_brick and clientutils.execute_on_mount. This is to help the scripts for matching output expressions after the execution of command. Reflecting the same changes in cli/volume/top/testcases
Change-Id: I5ce9d0141f6171dad2d3a17512f0264b9af5beb3
Signed-off-by: Shwetha-H-Panduranga <shwetha@gluster.com>
-rw-r--r-- | TestUnits/cli/volume/top/testcases.py | 12 | ||||
-rw-r--r-- | libs/utils/clientutils.py | 2 | ||||
-rw-r--r-- | libs/utils/serverutils.py | 11 |
3 files changed, 15 insertions, 10 deletions
diff --git a/TestUnits/cli/volume/top/testcases.py b/TestUnits/cli/volume/top/testcases.py index 99775b5..182f29d 100644 --- a/TestUnits/cli/volume/top/testcases.py +++ b/TestUnits/cli/volume/top/testcases.py @@ -155,9 +155,9 @@ def bug2725a(): commands.append("echo 'Hello World' > " + dir_name) commands.append("find . | xargs touch") for command in commands: - return_status = clientutils.execute_on_mount("mount1", command) - if return_status: - return return_status + output = clientutils.execute_on_mount("mount1", command) + if output["exitstatus"]: + return 1 command = "gluster volume top <volume1.volumename> open" expected_output = "" @@ -178,9 +178,9 @@ def bug2725b(): commands.append("echo 'Hello World' > " + dir_name) commands.append("find . | xargs touch") for command in commands: - return_status = clientutils.execute_on_mount("mount1", command) - if return_status: - return return_status + output = clientutils.execute_on_mount("mount1", command) + if output["exitstatus"]: + return 1 commands = [] commands.append("gluster volume top <volume1.volumename> open") diff --git a/libs/utils/clientutils.py b/libs/utils/clientutils.py index 9003c75..4de2998 100644 --- a/libs/utils/clientutils.py +++ b/libs/utils/clientutils.py @@ -176,7 +176,7 @@ def execute_on_mount(mountkey, command, commandInput=None): mountdir = mount_obj.dir command = "cd " + mountdir + " ;" + command output = hostutils.execute_command(clientkey, command, commandInput) - return output['exitstatus'] + return output __all__ = ['execute_on_mount', 'umount', diff --git a/libs/utils/serverutils.py b/libs/utils/serverutils.py index 226f35e..068dd17 100644 --- a/libs/utils/serverutils.py +++ b/libs/utils/serverutils.py @@ -7,6 +7,11 @@ from atfglobals import GlobalObj def execute_on_brick(brickkey, command, commandInput=None): """ """ + output = {} + output["exitstatus"] = None + output["stdoutdata"] = None + output["stderrdata"] = None + logger = GlobalObj.getLoggerObj() env = GlobalObj.getTestenvObj() @@ -14,19 +19,19 @@ def execute_on_brick(brickkey, command, commandInput=None): if not raw_brick_obj: logger.error("InValid Brick. %s not defined in TestEnvironment" % brickkey) - return 1 + return output serverkey = re.split("\.", raw_brick_obj.hostname, maxsplit=1)[0] brick_obj = env.getBrick(brickkey) if not brick_obj: logger.error("InValid Brick. %s not defined in TestEnvironment" % brickkey) - return 1 + return output exportdirpath = brick_obj.path command = "cd " + exportdirpath + ";" + command output = hostutils.execute_command(serverkey, command, commandInput) - return output['exitstatus'] + return output __all__ = ['execute_on_brick'] |