def _filter_default_partitions(requests): """Filter default partitions based on the kickstart data. :param requests: a list of requests :return: a customized list of requests """ auto_part_proxy = STORAGE.get_proxy(AUTO_PARTITIONING) skipped_mountpoints = set() skipped_fstypes = set() # Create sets of mountpoints and fstypes to remove from autorequests. if auto_part_proxy.Enabled: # Remove /home if --nohome is selected. if auto_part_proxy.NoHome: skipped_mountpoints.add("/home") # Remove /boot if --noboot is selected. if auto_part_proxy.NoBoot: skipped_mountpoints.add("/boot") # Remove swap if --noswap is selected. if auto_part_proxy.NoSwap: skipped_fstypes.add("swap") # Swap will not be recommended by the storage checker. # TODO: Remove this code from this function. from pyanaconda.storage.checker import storage_checker storage_checker.set_constraint(STORAGE_SWAP_IS_RECOMMENDED, False) # Skip mountpoints we want to remove. return [ req for req in requests if req.mountpoint not in skipped_mountpoints and req.fstype not in skipped_fstypes ]
def set_constraint(self, name, value): """Set a constraint to a new value. :param str name: a name of the existing constraint :param value: a value of the constraint :raise: KeyError if the constraint does not exist """ storage_checker.set_constraint(name, value) log.debug("Constraint '%s' is set to '%s'.", name, value)
def set_storage_defaults_from_kickstart(storage): """Set the storage default values from a kickstart file. FIXME: A temporary workaround for UI. """ # Set the default filesystem types. auto_part_proxy = STORAGE.get_proxy(AUTO_PARTITIONING) request = PartitioningRequest.from_structure(auto_part_proxy.Request) if request.file_system_type: storage.set_default_fstype(request.file_system_type) if "swap" in request.excluded_mount_points: storage_checker.set_constraint(STORAGE_SWAP_IS_RECOMMENDED, False)
def set_storage_defaults_from_kickstart(storage): """Set the storage default values from a kickstart file. FIXME: A temporary workaround for UI. """ # Set the default filesystem types. auto_part_proxy = STORAGE.get_proxy(AUTO_PARTITIONING) request = PartitioningRequest.from_structure(auto_part_proxy.Request) if request.file_system_type: storage.set_default_fstype(request.file_system_type) if "swap" in request.excluded_mount_points: storage_checker.set_constraint(STORAGE_SWAP_IS_RECOMMENDED, False) # Set up the bootloader. boot_loader_proxy = STORAGE.get_proxy(BOOTLOADER) default_type = boot_loader_proxy.GetDefaultType() default_class = BootLoaderFactory.get_class_by_name(default_type) BootLoaderFactory.set_default_class(default_class)
if not services_proxy.DefaultTarget and anaconda.tui_mode: services_proxy.SetDefaultTarget(TEXT_ONLY_TARGET) # Set flag to prompt for missing ks data if not anaconda.interactive_mode: flags.ksprompt = False # Set minimal ram size to the storage checker. if anaconda.display_mode == constants.DisplayModes.GUI: min_ram = isys.MIN_GUI_RAM else: min_ram = isys.MIN_RAM from pyanaconda.storage.checker import storage_checker storage_checker.set_constraint(constants.STORAGE_MIN_RAM, min_ram) # Add a check for the snapshot requests. storage_checker.add_check(ksdata.snapshot.verify_requests) # Set the disk images. from pyanaconda.modules.common.constants.objects import DISK_SELECTION from pyanaconda.argument_parsing import name_path_pairs disk_select_proxy = STORAGE.get_proxy(DISK_SELECTION) disk_images = {} try: for (name, path) in name_path_pairs(opts.images): log.info("naming disk image '%s' '%s'", path, name) disk_images[name] = path except ValueError as e: