Commits

Rodrigo Bistolfi committed 9dfd703

Fix #16 - Partition hosting ISO sholdnt be available as target for install

Comments (0)

Files changed (3)

vinstall/backend/installmedia.py

         finders = [ CdRomInstallMediaFinder(), PartitionInstallMediaFinder() ]
         return chain(*[i.find() for i in finders])
 
-    def __init__(self, path, config):
+    def __init__(self, device, path, config):
         """Expose install media base dir and the config object
 
         """
+        self.device = device
         self.path = path
         self.config = config
 
                 needs_umount = True
             if is_install_media(cdrom.mountpoint):
                 config = parse_config(cdrom.mountpoint)
-                yield InstallMedia(cdrom.device_path, config)
+                yield InstallMedia(cdrom, cdrom.device_path, config)
             if needs_umount:
                 cdrom.umount()
 
                 needs_umount = True
             if is_install_media(partition.mountpoint):
                 config = parse_config(partition.mountpoint)
-                yield InstallMedia(partition.mountpoint, config)
+                yield InstallMedia(partition, partition.mountpoint, config)
             else:
-                isofinder = ISOInstallMediaFinder(partition.mountpoint)
+                isofinder = ISOInstallMediaFinder(partition)
                 for im in isofinder.find():
                     yield im
             if needs_umount:
 class ISOInstallMediaFinder(InstallMediaFinder):
     "Find install media in ISO files"
 
-    def __init__(self,root_dir):
-        self.root_dir = root_dir
+    def __init__(self, partition):
+        self.partition = partition
+        self.root_dir = partition.mountpoint
         self.mountpoint = "/tmp/ISOMNT"
         create_mountpoint(self.mountpoint)
 
                 mountiso(isopath, self.mountpoint)
                 if is_install_media(self.mountpoint):
                     config = parse_config(self.mountpoint)
-                    yield InstallMedia(isopath, config)
+                    yield InstallMedia(self.partition, isopath, config)
                 umount(self.mountpoint)
 
 

vinstall/backend/mountpoints.py

 """
 
 import os
-from vinstall.backend.media import Partition
+
 
 class MountPoints(object):
-    
+
     DEFAULT_ROOT_FS = "ext3" # Default os to be used for /, unless changed by the user.
     MINIMUM_ROOT_SIZE = 4 # Size in GB
 
-    def __init__(self):
+    def __init__(self, partitions):
 
-        self.partitions = set(Partition.all())
+        self.partitions = set(partitions)
         self.filesystems = set(["ext2", "ext3", "ext4", "reiserfs", "xfs",
             "jfs", "swap"])
         self.mountpoints = set(["/", "home", "boot", "var", "tmp", "opt",
             "usr", "swap"])
         self.mapping = dict((i, [None, None]) for i in self.partitions)
-        
+
         self.default_filesystem = self.DEFAULT_ROOT_FS
         #XX: ^^ For compatibility purposes only.
 

vinstall/controller/mountpoints.py

     """
     def init(self):
         self.config["mountpoints"] = []
+        source = self.config["install_media"].device.device_path
+        self.partitions = [ p for p in Partition.all() if p.device_path != source ]
+        for p in self.partitions:
+            print p.device_path
+        print "####", source
 
     def render(self):
         """Show mount options
         """
         title = "Mountpoints"
         intro = "Setup mountpoints for your new system.\n"
-        self.render = Render(title, intro, mountpoints.MountPoints())
-        return self.render
-        #return Render(title, intro, mountpoints.MountPoints())
+        return Render(title, intro, mountpoints.MountPoints(self.partitions))
 
     def next(self):
         """Return next step