Ejemplo n.º 1
0
 def _check_method(self, method, kickstart):
     """Check the partitioning method of the given kickstart."""
     specification = StorageKickstartSpecification
     handler = KickstartSpecificationHandler(specification)
     parser = KickstartSpecificationParser(handler, specification)
     parser.readKickstartFromString(kickstart)
     self.assertEqual(method, PartitioningFactory.get_method_for_kickstart(handler))
Ejemplo n.º 2
0
    def create_partitioning(self, method: PartitioningMethod):
        """Create a new partitioning.

        Allowed values:
            AUTOMATIC
            CUSTOM
            MANUAL
            INTERACTIVE
            BLIVET

        :param PartitioningMethod method: a partitioning method
        :return: a partitioning module
        """
        module = PartitioningFactory.create_partitioning(method)

        # Update the module.
        module.on_storage_changed(self._current_storage)
        module.on_selected_disks_changed(
            self._disk_selection_module.selected_disks)

        # Connect the callbacks to signals.
        self.storage_changed.connect(module.on_storage_changed)
        self.partitioning_reset.connect(module.on_partitioning_reset)
        self._disk_selection_module.selected_disks_changed.connect(
            module.on_selected_disks_changed)

        # Update the list of modules.
        self._add_created_partitioning(module)
        return module
Ejemplo n.º 3
0
 def create_partitioning_test(self):
     """Test create_partitioning."""
     for method in PartitioningMethod:
         module = PartitioningFactory.create_partitioning(method)
         self.assertIsInstance(module, PartitioningModule)
         self.assertIsInstance(module.for_publication(), PartitioningInterface)
         self.assertEqual(module.partitioning_method, method)
 def test_create_partitioning(self):
     """Test create_partitioning."""
     for method in PartitioningMethod:
         module = PartitioningFactory.create_partitioning(method)
         assert isinstance(module, PartitioningModule)
         assert isinstance(module.for_publication(), PartitioningInterface)
         assert module.partitioning_method == method
Ejemplo n.º 5
0
    def process_kickstart(self, data):
        """Process the kickstart data."""
        # Process the kickstart data in modules.
        for kickstart_module in self._modules:
            kickstart_module.process_kickstart(data)

        # Set the default filesystem type.
        if data.autopart.autopart and data.autopart.fstype:
            self.storage.set_default_fstype(data.autopart.fstype)

        # Create a new partitioning module.
        partitioning_method = PartitioningFactory.get_method_for_kickstart(data)

        if partitioning_method:
            partitioning_module = self.create_partitioning(partitioning_method)
            partitioning_module.process_kickstart(data)
Ejemplo n.º 6
0
 def failed_partitioning_test(self):
     """Test failed create_partitioning."""
     with self.assertRaises(ValueError):
         PartitioningFactory.create_partitioning("INVALID")
 def test_failed_partitioning(self):
     """Test failed create_partitioning."""
     with pytest.raises(ValueError):
         PartitioningFactory.create_partitioning("INVALID")