From 466dd9e94ccc8283da84de69db4173c32949fbb6 Mon Sep 17 00:00:00 2001 From: Tim Date: Sun, 31 Jul 2011 16:17:13 +0530 Subject: Added add_user_cifs_all.py, delete_user_cifs_all.py, grun.py Removed Common.py. Functions from Common.py are moved to Utils.py Updated Globals.py with web server url, gluster backend configuration folder --- .../WebContent/scripts/grun.py | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 src/com.gluster.storage.management.server/WebContent/scripts/grun.py (limited to 'src/com.gluster.storage.management.server/WebContent/scripts/grun.py') diff --git a/src/com.gluster.storage.management.server/WebContent/scripts/grun.py b/src/com.gluster.storage.management.server/WebContent/scripts/grun.py new file mode 100755 index 00000000..ae93b7f2 --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/scripts/grun.py @@ -0,0 +1,36 @@ +#!/usr/bin/python +# Copyright (C) 2011 Gluster, Inc. +# This file is part of Gluster Management Gateway. +# + +import os +import sys +import Utils + + +def main(): + sshCommandPrefix = "ssh -q -o BatchMode=yes -o GSSAPIAuthentication=no -o PasswordAuthentication=no -o StrictHostKeyChecking=no".split() + + if len(sys.argv) < 3: + sys.stderr.write("usage: %s SERVER_FILE COMMAND [ARGUMENTS]\n" % os.path.basename(sys.argv[0])) + sys.exit(-1) + serverFile = sys.argv[1] + command = sys.argv[2:] + + try: + fp = open(serverFile) + serverNameList = fp.readlines() + fp.close() + except IOError, e: + Utils.log("Failed to read server file %s: %s\n" % (serverFile, str(e))) + sys.exit(1) + + for serverName in serverNameList: + rv = Utils.runCommand(sshCommandPrefix + [serverName.strip()] + command) + print rv + + sys.exit(0) + + +if __name__ == "__main__": + main() -- cgit