add paths based on monitorconfig values
[monitor.git] / getconf.py
index f40e108..56cf1b8 100755 (executable)
@@ -1,38 +1,37 @@
 #!/usr/bin/python
 
-import auth
 import plc
+api = plc.getAuthAPI()
 import sys
 import os
 
 def getconf(hostname, force=False, media=None):
-       api = plc.PLC(auth.auth, auth.plc)
        n = api.GetNodes(hostname)
-       filename = "bootcd-alpha/" + hostname + ".txt"
+       filename = "bootcd/" + hostname + ".txt"
        if not os.path.exists(filename) or force:
-               f = open("bootcd-alpha/" + hostname + ".txt", 'w')
+               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 = {}
        if not media:
-               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
+               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://pl-virtual-03.cs.princeton.edu/bootcds/%s-partition.usb\n" % hostname
+                       args['url_list']  = "   http://monitor.planet-lab.org/bootcds/%s-partition.usb\n" % hostname
                elif media == "iso":
-                       args['url_list']  = "   http://pl-virtual-03.cs.princeton.edu/bootcds/%s.iso" % hostname
+                       args['url_list']  = "   http://monitor.planet-lab.org/bootcds/%s.iso" % hostname
                else:
-                       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
+                       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://pl-virtual-03.cs.princeton.edu/bootcds/%s.usb\n" % hostname
+       #print "http://monitor.planet-lab.org/bootcds/%s.usb\n" % hostname
 
        return args