get rid of the old dirty trick that allowed to spot the right bootstrapfs for alpha...
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Thu, 14 Jan 2010 15:55:15 +0000 (15:55 +0000)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Thu, 14 Jan 2010 15:55:15 +0000 (15:55 +0000)
the bootmanager configuration is not patched anymore, instead we rely on GetNodeDeployment

build.sh
source/configuration
source/steps/InstallBootstrapFS.py
source/steps/ReadNodeConfiguration.py

index 06e9f00..162f73b 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -28,9 +28,6 @@ BOOTSTRAPDIR="/boot"
 # Change to our source directory
 cd $(dirname $0)
 
-# Translate configuration file
-sed -i -e "s|SUPPORT_FILE_DIR=.*|SUPPORT_FILE_DIR=$BOOTSTRAPDIR|" source/configuration
-
 # Source bootmanager configuration
 . source/configuration
 
index e21933a..48ddbc9 100644 (file)
@@ -50,11 +50,6 @@ NONCE_FILE=/tmp/nonce
 PLCONF_DIR=/etc/planetlab
 
 
-# directory on the boot server containing
-# support files and scripts
-SUPPORT_FILE_DIR=/boot
-
-
 # this sets the size of the root logical volume,
 # after the root and swap has been created, remaining
 # goes to the vserver partition
index 2c49acc..93ef59d 100644 (file)
@@ -27,8 +27,6 @@ def Run( vars, log ):
     SYSIMG_PATH          the path where the system image will be mounted
     PARTITIONS           dictionary of generic part. types (root/swap)
                          and their associated devices.
-    SUPPORT_FILE_DIR     directory on the boot servers containing
-                         scripts and support files
     NODE_ID              the id of this machine
     
     Sets the following variables:
@@ -50,10 +48,6 @@ def Run( vars, log ):
         if PARTITIONS == None:
             raise ValueError, "PARTITIONS"
 
-        SUPPORT_FILE_DIR= vars["SUPPORT_FILE_DIR"]
-        if SUPPORT_FILE_DIR == None:
-            raise ValueError, "SUPPORT_FILE_DIR"
-
         NODE_ID= vars["NODE_ID"]
         if NODE_ID == "":
             raise ValueError, "NODE_ID"
@@ -91,6 +85,13 @@ def Run( vars, log ):
 
     vars['ROOT_MOUNTED']= 1
 
+    # fetch deployment tag (like, 'alpha' or the like)
+    try:
+        deployment = BootAPI.call_api_function(vars, "GetNodeDeployment", (NODE_ID,) )
+    except:
+        log.write("WARNING : Failed to query tag 'deployment'\n")
+        deployment = ""
+
     # which extensions are we part of ?
     utils.breakpoint("Checking for the extension(s) tags")
     extensions = []
@@ -166,17 +167,21 @@ def Run( vars, log ):
 
     log.write ("Using nodefamily=%s-%s\n"%(pldistro,arch))
 
-    bootstrapfs_names = [ pldistro ] + extensions
+    # deployment is enough, let operators put what they want in there
+    if deployment:
+        bootstrapfs_names = [ deployment ]
+    else:
+        bootstrapfs_names = [ "%s-%s"%(x,arch) for x in [ pldistro ] + extensions ]
 
     # download and extract support tarball for this step, which has
     # everything we need to successfully run
 
-    # we first try to find a tarball, if it is not found we use yum instead
+    # installing extensions through yum has been dismantled
     yum_extensions = []
     # download and extract support tarball for this step, 
-    for bootstrapfs_name in bootstrapfs_names:
-        tarball = "bootstrapfs-%s-%s%s"%(bootstrapfs_name,arch,download_suffix)
-        source_file= "%s/%s" % (SUPPORT_FILE_DIR,tarball)
+    for name in bootstrapfs_names:
+        tarball = "bootstrapfs-%s%s"%(name,download_suffix)
+        source_file= "/boot/%s" % (SUPPORT_FILE_DIR,tarball)
         dest_file= "%s/%s" % (SYSIMG_PATH, tarball)
 
         # 30 is the connect timeout, 14400 is the max transfer time in
@@ -192,12 +197,12 @@ def Run( vars, log ):
             utils.removefile( dest_file )
         else:
             # the main tarball is required
-            if bootstrapfs_name == pldistro:
+            if name == "%s-%s"%(pldistro,arch):
                 raise BootManagerException, "Unable to download main tarball %s from server." % \
                     source_file
             else:
-                log.write("tarball for %s-%s not found, scheduling a yum attempt\n"%(bootstrapfs_name,arch))
-                yum_extensions.append(bootstrapfs_name)
+                log.write("tarball for %s not found, scheduling a yum attempt\n"%(name))
+                yum_extensions.append(name)
 
     # copy resolv.conf from the base system into our temp dir
     # so DNS lookups work correctly while we are chrooted
index 9c9f0df..09e6e1b 100644 (file)
@@ -50,8 +50,6 @@ def Run( vars, log ):
     and read, return 1.
 
     Expect the following variables from the store:
-    SUPPORT_FILE_DIR         directory on the boot servers containing
-                             scripts and support files
     
     Sets the following variables from the configuration file:
     WAS_NODE_ID_IN_CONF         Set to 1 if the node id was in the conf file
@@ -83,16 +81,6 @@ def Run( vars, log ):
 
 
     # make sure we have the variables we need
-    try:
-        SUPPORT_FILE_DIR= vars["SUPPORT_FILE_DIR"]
-        if SUPPORT_FILE_DIR == None:
-            raise ValueError, "SUPPORT_FILE_DIR"
-
-    except KeyError, var:
-        raise BootManagerException, "Missing variable in vars: %s\n" % var
-    except ValueError, var:
-        raise BootManagerException, "Variable in vars, shouldn't be: %s\n" % var
-
 
     INTERFACE_SETTINGS= {}
     INTERFACE_SETTINGS['method']= "dhcp"
@@ -348,7 +336,6 @@ def __parse_configuration_file( vars, log, file_contents ):
     of the configuration file is completed.
     """
 
-    SUPPORT_FILE_DIR= vars["SUPPORT_FILE_DIR"]
     INTERFACE_SETTINGS= vars["INTERFACE_SETTINGS"]
     
     if file_contents is None:
@@ -476,8 +463,7 @@ def __parse_configuration_file( vars, log, file_contents ):
         bs_request= BootServerRequest.BootServerRequest(vars)
         
         postVars= {"mac_addr" : INTERFACE_SETTINGS["mac"]}
-        result= bs_request.DownloadFile( "%s/getnodeid.php" %
-                                         SUPPORT_FILE_DIR,
+        result= bs_request.DownloadFile( "/boot/getnodeid.php",
                                          None, postVars, 1, 1,
                                          "/tmp/node_id")
         if result == 0: