Fix incorrect type for livecd/modblacklist.
[catalyst.git] / modules / livecd_stage2_target.py
index 11dcc63274e2d1b03d61eb86193e001b5ca0c3e9..5be8fd23870d7955eee29230de511ddd8ea5b84f 100644 (file)
@@ -13,9 +13,9 @@ class livecd_stage2_target(generic_stage_target):
        """
        def __init__(self,spec,addlargs):
                self.required_values=["boot/kernel"]
-               
+
                self.valid_values=[]
-               
+
                self.valid_values.extend(self.required_values)
                self.valid_values.extend(["livecd/cdtar","livecd/empty","livecd/rm",\
                        "livecd/unmerge","livecd/iso","livecd/gk_mainargs","livecd/type",\
@@ -25,13 +25,13 @@ class livecd_stage2_target(generic_stage_target):
                        "livecd/root_overlay","livecd/users","portage_overlay",\
                        "livecd/fstype","livecd/fsops","livecd/linuxrc","livecd/bootargs",\
                        "gamecd/conf","livecd/xdm","livecd/xsession","livecd/volid"])
-               
+
                generic_stage_target.__init__(self,spec,addlargs)
-               if not self.settings.has_key("livecd/type"):
+               if "livecd/type" not in self.settings:
                        self.settings["livecd/type"] = "generic-livecd"
 
                file_locate(self.settings, ["cdtar","controller_file"])
-       
+
        def set_source_path(self):
                self.settings["source_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["source_subpath"]+".tar.bz2")
                if os.path.isfile(self.settings["source_path"]):
@@ -40,13 +40,13 @@ class livecd_stage2_target(generic_stage_target):
                        self.settings["source_path"]=normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/")
                if not os.path.exists(self.settings["source_path"]):
                        raise CatalystError,"Source Path: "+self.settings["source_path"]+" does not exist."
-       
+
        def set_spec_prefix(self):
            self.settings["spec_prefix"]="livecd"
 
        def set_target_path(self):
                self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["target_subpath"]+"/")
-               if self.settings.has_key("AUTORESUME") \
+               if "AUTORESUME" in self.settings \
                        and os.path.exists(self.settings["autoresume_path"]+"setup_target_path"):
                                print "Resume point detected, skipping target path setup operation..."
                else:
@@ -60,18 +60,21 @@ class livecd_stage2_target(generic_stage_target):
 
        def run_local(self):
                # what modules do we want to blacklist?
-               if self.settings.has_key("livecd/modblacklist"):
+               if "livecd/modblacklist" in self.settings:
                        try:
                                myf=open(self.settings["chroot_path"]+"/etc/modprobe.d/blacklist.conf","a")
                        except:
                                self.unbind()
                                raise CatalystError,"Couldn't open "+self.settings["chroot_path"]+"/etc/modprobe.d/blacklist.conf."
-                       
+
                        myf.write("\n#Added by Catalyst:")
+                       # workaround until config.py is using configparser
+                       if isinstance(self.settings["livecd/modblacklist"], str):
+                               self.settings["livecd/modblacklist"] = self.settings["livecd/modblacklist"].split()
                        for x in self.settings["livecd/modblacklist"]:
                                myf.write("\nblacklist "+x)
                        myf.close()
-       
+
        def unpack(self):
                unpack=True
                display_msg=None
@@ -85,12 +88,12 @@ class livecd_stage2_target(generic_stage_target):
                        error_msg="Rsync of "+self.settings["source_path"]+" to "+self.settings["chroot_path"]+" failed."
                        invalid_snapshot=False
 
-               if self.settings.has_key("AUTORESUME"):
+               if "AUTORESUME" in self.settings:
                        if os.path.isdir(self.settings["source_path"]) and \
                                os.path.exists(self.settings["autoresume_path"]+"unpack"):
                                print "Resume point detected, skipping unpack operation..."
                                unpack=False
-                       elif self.settings.has_key("source_path_hash"):
+                       elif "source_path_hash" in self.settings:
                                if self.settings["source_path_hash"] != clst_unpack_hash:
                                        invalid_snapshot=True
 
@@ -109,7 +112,7 @@ class livecd_stage2_target(generic_stage_target):
                        if not os.path.exists(self.settings["chroot_path"]+"/tmp"):
                                os.makedirs(self.settings["chroot_path"]+"/tmp",1777)
 
-                       if self.settings.has_key("PKGCACHE"):
+                       if "PKGCACHE" in self.settings:
                                if not os.path.exists(self.settings["pkgcache_path"]):
                                        os.makedirs(self.settings["pkgcache_path"],0755)
 
@@ -119,7 +122,7 @@ class livecd_stage2_target(generic_stage_target):
                        print display_msg
                        cmd(unpack_cmd,error_msg,env=self.env)
 
-                       if self.settings.has_key("source_path_hash"):
+                       if "source_path_hash" in self.settings:
                                myf=open(self.settings["autoresume_path"]+"unpack","w")
                                myf.write(self.settings["source_path_hash"])
                                myf.close()
@@ -131,7 +134,7 @@ class livecd_stage2_target(generic_stage_target):
                                "config_profile_link","setup_confdir","portage_overlay",\
                                "bind","chroot_setup","setup_environment","run_local",\
                                "build_kernel"]
-               if not self.settings.has_key("FETCH"):
+               if "FETCH" not in self.settings:
                        self.settings["action_sequence"] += ["bootloader","preclean",\
                                "livecd_update","root_overlay","fsscript","rcupdate","unmerge",\
                                "unbind","remove","empty","target_setup",\