fix how bm gets tags - test node now installs in 1'40'' for download+extract
[bootmanager.git] / source / steps / InstallBootstrapFS.py
index b36e601..f7e9be0 100644 (file)
@@ -10,6 +10,7 @@
 import os, sys, string
 import popen2
 import shutil
+import traceback 
 
 from Exceptions import *
 import utils
@@ -92,14 +93,33 @@ def Run( vars, log ):
 
     # which extensions are we part of ?
     utils.breakpoint("Getting the extension tag on node")
+    extensions = []
     try:
-        extension_tag = BootAPI.call_api_function(vars, "GetNodeExtensions", ([NODE_ID]))
-        extensions = extension_tag.split()
+        extension_tag = BootAPI.call_api_function(vars, "GetNodeExtensions", (NODE_ID,) )
+        if extension_tag:
+            extensions = extension_tag.split()
 
     except:
-        log.write("WARNING : Failed to query the extension tag - installing only core software\n")
-        extensions = []
+        log.write("WARNING : Failed to query tag 'extensions'")
+        log.write(traceback.format_exc())
+
+    if not extensions:
+        log.write("installing only core software\n")
     
+    # check if the plain-bootstrapfs tag is set
+    download_suffix=".tar.bz2"
+    untar_option="-j"
+    try:
+        if BootAPI.call_api_function (vars, "GetNodePlainBootstrapfs", (NODE_ID,) ):
+            download_suffix=".tar"
+            untar_option=""
+    except:
+        log.write("WARNING : Failed to query tag 'plain-bootstrapfs'")
+        log.write(traceback.format_exc())
+
+    if not untar_option:
+        log.write("Using uncompressed bootstrapfs images\n")
+
     # see also GetBootMedium in PLCAPI that does similar things
     # figuring the default node family:
     # (1) look at /etc/planetlab/nodefamily on the bootcd
@@ -112,11 +132,14 @@ def Run( vars, log ):
         pldistro="planetlab"
         default_arch="i386"
         try:
-            arch = BootAPI.call_api_function(vars, "GetNodeArch", ([NODE_ID]))
+            arch = BootAPI.call_api_function(vars, "GetNodeArch", (NODE_ID,) )
         except:
-            log.write("WARNING : Failed to query node arch - using %(default_arch)s\n"%locals())
+            log.write("WARNING : Failed to query tag 'arch'")
+            log.write(traceback.format_exc())
             arch = default_arch
 
+    log.write ("Using arch=%s\n"%arch)
+
     bootstrapfs_names = [ pldistro ] + extensions
 
     # download and extract support tarball for this step, which has
@@ -126,7 +149,7 @@ def Run( vars, log ):
     yum_extensions = []
     # download and extract support tarball for this step, 
     for bootstrapfs_name in bootstrapfs_names:
-        tarball = "bootstrapfs-%s-%s.tar.bz2"%(bootstrapfs_name,arch)
+        tarball = "bootstrapfs-%s-%s%s"%(bootstrapfs_name,arch,download_suffix)
         source_file= "%s/%s" % (SUPPORT_FILE_DIR,tarball)
         dest_file= "%s/%s" % (SYSIMG_PATH, tarball)
 
@@ -138,7 +161,7 @@ def Run( vars, log ):
                                          30, 14400)
         if result:
             log.write( "extracting %s in %s\n" % (dest_file,SYSIMG_PATH) )
-            result= utils.sysexec( "tar -C %s -xpjf %s" % (SYSIMG_PATH,dest_file), log )
+            result= utils.sysexec( "tar -C %s -xpf %s %s" % (SYSIMG_PATH,dest_file,untar_option), log )
             log.write( "Done\n")
             utils.removefile( dest_file )
         else: