[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r23211 - gnunet-planetlab/gplmt/scripts
From: |
gnunet |
Subject: |
[GNUnet-SVN] r23211 - gnunet-planetlab/gplmt/scripts |
Date: |
Mon, 13 Aug 2012 17:51:41 +0200 |
Author: wachs
Date: 2012-08-13 17:51:41 +0200 (Mon, 13 Aug 2012)
New Revision: 23211
Added:
gnunet-planetlab/gplmt/scripts/create_buildbot_configuration.py
Log:
- slave pwd generation
Added: gnunet-planetlab/gplmt/scripts/create_buildbot_configuration.py
===================================================================
--- gnunet-planetlab/gplmt/scripts/create_buildbot_configuration.py
(rev 0)
+++ gnunet-planetlab/gplmt/scripts/create_buildbot_configuration.py
2012-08-13 15:51:41 UTC (rev 23211)
@@ -0,0 +1,95 @@
+#!/usr/bin/python
+import getopt, sys, xmlrpclib, random
+
+
+def usage():
+ print "GNUnet PlanetLab deployment and automation toolset\n\
+Arguments mandatory for long options are also mandatory for short options.\n\
+ -u, --user= Planetlab username\n\
+ -p, --password= Planetlab password\n\
+ -s, --slice= Planetlab slice\n\
+ -f, --file= file containing nodes\n\
+ -o, --outputdir= where to store slave configuration\n\
+ -h, --help print this help\n\
+Report bugs to address@hidden \n\
+GNUnet home page: http://www.gnu.org/software/gnunet/ \n\
+General help using GNU software: http://www.gnu.org/gethelp/"
+
+
+user = None
+password = None
+plslice = None
+filename = None
+outputdir = "./"
+
+try:
+ opts, args = getopt.getopt(sys.argv[1:], "hu:p:s:f:o:", ["help", "user=",
"password=", "slice=", "file=", "outputdir"])
+except getopt.GetoptError, err:
+ # print help information and exit:
+ print str(err) # will print something like "option -a not recognized"
+ usage()
+ sys.exit(2)
+for o, a in opts:
+ if o in ("-h", "--help"):
+ usage()
+ sys.exit()
+ elif o in ("-u", "--user"):
+ user = a
+ elif o in ("-p", "--password"):
+ password = a
+ elif o in ("-s", "--slice"):
+ plslice = a
+ elif o in ("-f", "--file"):
+ filename = a
+ elif o in ("-o", "--outputdir"):
+ outputdir = a
+ else:
+ assert False, "unhandled option"
+
+if (((user == None) or (password == None) or (slice == None)) and
+ (filename == None)):
+ usage()
+ sys.exit(2)
+
+# PlanetLab Europe
+api_url = "https://www.planet-lab.eu/PLCAPI/"
+# Planetlab Central
+#api_url = https://www.planet-lab.org/PLCAPI/
+
+server = xmlrpclib.ServerProxy(api_url)
+
+# the auth struct
+auth = {}
+auth['Username'] = user
+auth['AuthString'] = password
+auth['AuthMethod'] = "password"
+
+slice_data = {}
+slice_data['name'] = plslice
+
+# request nodes assigned to slice
+try:
+ node_ids = server.GetSlices(auth, [slice_data['name']],
['node_ids'])[0]['node_ids']
+ node_hostnames = [node['hostname'] for node in server.GetNodes(auth,
node_ids, ['hostname'])]
+except Exception as e:
+ print "Error while retrieving node list: " + str(e)
+ sys.exit (2)
+master_cfg_buildslave = "c['slaves'] = ["
+for node in node_hostnames:
+
+ password =
''.join([random.choice('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890')
for i in range(64)])
+ master_cfg_buildslave += 'BuildSlave("'+node+'","'+password+'"),\n'
+ try:
+ f = open(outputdir + '/' + node, 'w')
+ f.writelines (node +";" +password)
+ f.close()
+ except IOError as e:
+ print str(e)
+ sys.exit (2)
+master_cfg_buildslave += "]"
+
+
+print master_cfg_buildslave
+
+
+
Property changes on:
gnunet-planetlab/gplmt/scripts/create_buildbot_configuration.py
___________________________________________________________________
Added: svn:executable
+ *
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r23211 - gnunet-planetlab/gplmt/scripts,
gnunet <=