- back out change that was going to be used for federation stage 1, which
authorAaron Klingaman <alk@cs.princeton.edu>
Mon, 21 Nov 2005 17:15:17 +0000 (17:15 +0000)
committerAaron Klingaman <alk@cs.princeton.edu>
Mon, 21 Nov 2005 17:15:17 +0000 (17:15 +0000)
was to assume boot server = api server, returning api server configuration
variable.
- bump version

source/BootManager.py
source/configuration
source/steps/InitializeBootManager.py

index 8f952b4..fdda2a3 100755 (executable)
@@ -62,7 +62,7 @@ import notify_messages
 # all output is written to this file
 LOG_FILE= "/tmp/bm.log"
 CURL_PATH= "curl"
-
+UPLOAD_LOG_URL = "http://boot.planet-lab.org/alpina-logs/upload.php"
 
 # the new contents of PATH when the boot manager is running
 BIN_PATH= ('/usr/local/bin',
@@ -78,9 +78,6 @@ BIN_PATH= ('/usr/local/bin',
 class log:
 
     def __init__( self, OutputFilePath= None ):
-
-        self.UPLOAD_LOG_URL= None
-        
         if OutputFilePath:
             try:
                 self.OutputFilePath= OutputFilePath
@@ -106,6 +103,7 @@ class log:
             self.OutputFile.flush()
 
             
+
     def write( self, str ):
         """
         make log behave like a writable file object (for traceback
@@ -114,27 +112,21 @@ class log:
         self.LogEntry( str, 0, 1 )
 
 
-    def SetUploadServer( self, server ):
-        """
-        set the url we should use to upload the logs to
-        """
-        self.UPLOAD_LOG_URL = "http://%s/alpina-logs/upload.php" % server
-
     
     def Upload( self ):
         """
         upload the contents of the log to the server
         """
 
-        if self.OutputFile is not None and self.UPLOAD_LOG_URL is not None:
-            self.LogEntry( "Uploading logs to %s" % self.UPLOAD_LOG_URL )
+        if self.OutputFile is not None:
+            self.LogEntry( "Uploading logs to %s" % UPLOAD_LOG_URL )
             
             self.OutputFile.close()
             self.OutputFile= None
             
             curl_cmd= "%s -s --connect-timeout 60 --max-time 600 " \
                       "--form log=@%s %s" % \
-                      (CURL_PATH, self.OutputFilePath, self.UPLOAD_LOG_URL)
+                      (CURL_PATH, self.OutputFilePath, UPLOAD_LOG_URL)
             os.system( curl_cmd )
         
     
@@ -172,7 +164,7 @@ class BootManager:
         # not sure what the current PATH is set to, replace it with what
         # we know will work with all the boot cds
         os.environ['PATH']= string.join(BIN_PATH,":")
-        
+                   
         self.CAN_RUN= 1
         
 
index 80d5735..6d97e05 100644 (file)
@@ -4,7 +4,11 @@
 
 
 # the current version of the bootmanager
-VERSION=3.1.10
+VERSION=3.1.11
+
+
+# full url to which api server to contact
+BOOT_API_SERVER=https://www.planet-lab.org:443/PLCAPI/
 
 
 # path to store temporary files during the install,
index 97de995..c129d63 100644 (file)
@@ -11,14 +11,6 @@ import utils
 BOOT_VERSION_2X_FILE='/usr/bootme/ID'
 BOOT_VERSION_3X_FILE='/pl_version'
 
-# locations of boot server name/certificate files
-V2X_BOOTCD_SERVER_FILE = "/usr/bootme/BOOTSERVER"
-V2X_BOOTCD_SERVER_CACERT_DIR = "/usr/bootme/cacert"
-V2X_CACERT_NAME = "cacert.pem"
-    
-V3X_BOOTCD_SERVER_FILE = "/usr/boot/boot_server"
-V3X_BOOTCD_SERVER_CACERT = "/usr/boot/cacert.pem"
-
 # minimium version of the boot os we need to run, as a (major,minor) tuple
 MINIMUM_BOOT_VERSION= (2,0)
 
@@ -33,14 +25,19 @@ def Run( vars, log ):
 
     Sets the following variables:
     BOOT_CD_VERSION           A two number tuple of the boot cd version
-    MA_BOOT_SERVER            The boot server we contacted, identified from
-                              files on the boot cd.
-    MA_BOOT_SERVER_CACERT     The SSL certificate for the above server
-
     """
 
     log.write( "\n\nStep: Initializing the BootManager.\n" )
 
+    
+    log.write( "Opening connection to API server\n" )
+    try:
+        api_inst= xmlrpclib.Server( vars['BOOT_API_SERVER'], verbose=0 )
+    except KeyError, e:
+        raise BootManagerException, \
+              "configuration file does not specify API server URL"
+
+    vars['API_SERVER_INST']= api_inst
 
     if not __check_boot_version( vars, log ):
         raise BootManagerException, \
@@ -50,84 +47,6 @@ def Run( vars, log ):
                    str(vars['BOOT_CD_VERSION']) )
 
     BOOT_CD_VERSION= vars['BOOT_CD_VERSION']
-
-
-    log.write( "Identifying boot server and setting up /etc/planetlab entries" )
-
-    # need to pull the server name we contacted. 2.x cds will have the
-    # info in /usr/bootme; 3.x cds in /usr/boot
-    if BOOT_CD_VERSION[0] == 2:
-        try:
-            boot_server= file(V2X_BOOTCD_SERVER_FILE).readline().strip()                
-        except IOError:
-            raise BootManagerException, \
-                  "It appears we are running on a v2.x boot cd, but could " \
-                  "not load contacted boot server from %s" % V2X_BOOTCD_SERVER_FILE
-        
-        if boot_server == "":
-            raise BootManagerException, \
-                  "It appears we are running on a v2.x boot cd, but %s " \
-                  "appears to be blank." % V2X_BOOTCD_SERVER_FILE
-
-        cacert_file= "%s/%s/%s" % (V2X_BOOTCD_SERVER_CACERT_DIR,
-                                   boot_server, V2X_CACERT_NAME)
-
-    elif BOOT_CD_VERSION[0] == 3:
-        try:
-            boot_server= file(V3X_BOOTCD_SERVER_FILE).read().strip()                
-        except IOError:
-            raise BootManagerException, \
-                  "It appears we are running on a v3.x boot cd, but could " \
-                  "not load contacted boot server from %s" % V3X_BOOTCD_SERVER_FILE
-        
-        if boot_server == "":
-            raise BootManagerException, \
-                  "It appears we are running on a v3.x boot cd, but %s " \
-                  "appears to be blank." % V3X_BOOTCD_SERVER_FILE
-
-        cacert_file= V3X_BOOTCD_SERVER_CACERT
-
-    else:
-        raise BootManagerException, "Unknown boot cd version."
-
-    if not os.access(cacert_file, os.R_OK):
-        raise BootManagerException, \
-              "Could not find the certificate for the " \
-              "specified boot server (at %s)" % cacert_file
-
-    # tell the log instance about the boot server so it knows
-    # where to upload the logs
-    try:
-        log.SetUploadServer( self.VARS['MA_BOOT_SERVER'] )
-    except KeyError, e:
-        log.LogEntry( "configuration does not contain boot server name." )
-        return
-
-
-    # now that we have the boot server name and the location of its certificate,
-    # write out /etc/planetlab/primary_ma with this info.
-    try:
-        primary_ma_file= file("/etc/planetlab/primary_ma","w")
-        primary_ma_file.write( "MA_NAME=\"Unknown\"\n" )
-        primary_ma_file.write( "MA_BOOT_SERVER=\"%s\"\n" % boot_server )
-        primary_ma_file.write( "MA_BOOT_SERVER_CACERT=\"%s\"\n" % cacert_file )
-        primary_ma_file.close()
-        primary_ma_file= None
-    except IOError:
-        raise BootManagerException, "Unable to write out /etc/planetlab/primary_ma"
-    
-    vars['MA_BOOT_SERVER']= boot_server
-    vars['MA_BOOT_SERVER_CACRET']= cacert_file
-
-    self.Message( "Using boot server %s with certificate" %
-                  (boot_server,cacert_file) )
-
-    
-    log.write( "Opening connection to API server\n" )
-    api_server_url= "https://%s/PLCAPI/" % vars['MA_BOOT_SERVER']
-    api_inst= xmlrpclib.Server( api_server_url, verbose=0 )
-    vars['API_SERVER_INST']= api_inst
-
     
     # old cds need extra modules loaded for compaq smart array
     if BOOT_CD_VERSION[0] == 2: