"""serverutils module """ import re import hostutils from atfglobals import GlobalObj def execute_on_brick(brickkey, command, commandInput=None): """ """ logger = GlobalObj.getLoggerObj() env = GlobalObj.getTestenvObj() raw_brick_obj = env.getRawBrick(brickkey) if not raw_brick_obj: logger.error("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: logger.error("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']