summaryrefslogtreecommitdiffstats
path: root/libs/utils/serverutils.py
diff options
context:
space:
mode:
authorShwetha-H-Panduranga <shwetha@gluster.com>2011-12-07 11:56:48 +0530
committerShwetha-H-Panduranga <shwetha@gluster.com>2011-12-07 11:56:48 +0530
commit4399cf4d161526300244d8cf090a461c792ab82e (patch)
tree7ca5ad70b0429148c63ab77667e8e54acaf5b11e /libs/utils/serverutils.py
parent77c7f324610224e808d8940aec7e6dbf19b790a5 (diff)
Renaming Directories
Diffstat (limited to 'libs/utils/serverutils.py')
-rw-r--r--libs/utils/serverutils.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/libs/utils/serverutils.py b/libs/utils/serverutils.py
new file mode 100644
index 0000000..618ee23
--- /dev/null
+++ b/libs/utils/serverutils.py
@@ -0,0 +1,33 @@
+"""serverutils module
+"""
+import re
+import hostutils
+from atfglobals import GlobalObj
+
+def execute_on_brick(brickkey, command, commandInput=None):
+ """
+ """
+ env = GlobalObj.getTestenvObj()
+
+ raw_brick_obj = env.getRawBrick(brickkey)
+ if not raw_brick_obj:
+ print "InValid Brick. %s not defined in TestEnvironment" % brickkey
+ return 1
+ serverkey = re.split("\.", raw_brick_obj.hostname, maxsplit=1)[0]
+
+ brick_obj = env.getBrick(brickkey)
+ if not brick_obj:
+ print "InValid Brick. %s not defined in TestEnvironment" % brickkey
+ return 1
+ exportdirpath = brick_obj.path
+
+ command = "cd " + exportdirpath + ";" + command
+ return_status = hostutils.execute_command(serverkey, command, commandInput)
+ return return_status
+
+__all__ = ['execute_on_brick']
+
+
+
+
+