X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=getconf.py;h=155c26ff3b85bb9ca1292b55b609313f93cdcfd0;hb=d5b0651a666c9a6b2deb4103ed15c3c06075395d;hp=802eced210ae97595dcf8ca47c4db222746e0f02;hpb=590ac12c941310b40a92d2fe938e62e3538f2893;p=monitor.git diff --git a/getconf.py b/getconf.py index 802eced..155c26f 100755 --- a/getconf.py +++ b/getconf.py @@ -5,24 +5,34 @@ import plc import sys import os -def getconf(hostname): +def getconf(hostname, force=False, media=None): api = plc.PLC(auth.auth, auth.plc) n = api.GetNodes(hostname) - filename = "bootcd-alpha/" + hostname + ".txt" - if not os.path.exists(filename): - f = open("bootcd-alpha/" + hostname + ".txt", 'w') + filename = "bootcd/" + hostname + ".txt" + if not os.path.exists(filename) or force: + f = open("bootcd/" + hostname + ".txt", 'w') f.write( api.AdmGenerateNodeConfFile(n[0]['node_id']) ) f.close() - print os.system("cd bootcd-alpha; ./build.sh -f %s.txt -t iso -o /plc/data/var/www/html/bootcds/%s.iso &> /dev/null" % ( hostname, hostname)) - print os.system("cd bootcd-alpha; ./build.sh -f %s.txt -t usb_partition -o /plc/data/var/www/html/bootcds/%s-partition.usb &> /dev/null" % ( hostname, hostname)) + print os.system("cd bootcd; ./build.sh -f %s.txt -t iso -o /plc/data/var/www/html/bootcds/%s.iso &> /dev/null" % ( hostname, hostname)) + print os.system("cd bootcd; ./build.sh -f %s.txt -t usb_partition -o /plc/data/var/www/html/bootcds/%s-partition.usb &> /dev/null" % ( hostname, hostname)) else: # assume that the images have already been generated.. pass args = {} - args['url_list'] = " http://pl-virtual-03.cs.princeton.edu/bootcds/%s-partition.usb\n" % hostname - args['url_list'] += " http://pl-virtual-03.cs.princeton.edu/bootcds/%s.iso" % hostname - #print "http://pl-virtual-03.cs.princeton.edu/bootcds/%s.usb\n" % hostname + if not media: + args['url_list'] = " http://monitor.planet-lab.org/bootcds/%s-partition.usb\n" % hostname + args['url_list'] += " http://monitor.planet-lab.org/bootcds/%s.iso" % hostname + else: + if media == "usb": + args['url_list'] = " http://monitor.planet-lab.org/bootcds/%s-partition.usb\n" % hostname + elif media == "iso": + args['url_list'] = " http://monitor.planet-lab.org/bootcds/%s.iso" % hostname + else: + args['url_list'] = " http://monitor.planet-lab.org/bootcds/%s-partition.usb\n" % hostname + args['url_list'] += " http://monitor.planet-lab.org/bootcds/%s.iso" % hostname + + #print "http://monitor.planet-lab.org/bootcds/%s.usb\n" % hostname return args @@ -30,16 +40,18 @@ if __name__ == '__main__': from config import config as cfg from optparse import OptionParser parser = OptionParser() - parser.set_defaults(media='both') + parser.set_defaults(media='both', force=False) parser.add_option("", "--media", dest="media", metavar="usb, iso, both", help="""Which media to generate the message for.""") + parser.add_option("", "--force", dest="force", action="store_true", + help="""Force the recreation of the usb images.""") config = cfg(parser) config.parse_args() ret = {'url_list' : ''} for i in config.args: - conf = getconf(i) + conf = getconf(i, config.force, config.media) ret['url_list'] += conf['url_list'] ret['hostname'] = i @@ -68,7 +80,7 @@ Thank you, """ % ret - elif config.media == "cd": + elif config.media == "iso": print """ Hello,