def set_boot_loaders(self, boot_loaders): """ Setter of the boot loaders. :param boot_loaders: The boot loaders for the profile. """ if boot_loaders == "<<inherit>>": self.boot_loaders = "<<inherit>>" return if boot_loaders: boot_loaders_split = utils.input_string_or_list(boot_loaders) distro = self.get_conceptual_parent() if distro: distro_boot_loaders = distro.get_boot_loaders() else: distro_boot_loaders = utils.get_supported_system_boot_loaders() if not set(boot_loaders_split).issubset(distro_boot_loaders): raise CX( "Error with profile %s - not all boot_loaders %s are supported %s" % (self.name, boot_loaders_split, distro_boot_loaders)) self.boot_loaders = boot_loaders_split else: self.boot_loaders = []
def boot_loaders(self, boot_loaders: list): """ Setter of the boot loaders. :param boot_loaders: The boot loaders for the profile. :raises ValueError: In case the supplied boot loaders were not a subset of the valid ones. """ if boot_loaders == enums.VALUE_INHERITED: self._boot_loaders = enums.VALUE_INHERITED return if boot_loaders: boot_loaders_split = utils.input_string_or_list(boot_loaders) distro = self.get_conceptual_parent() if distro: distro_boot_loaders = distro.boot_loaders else: distro_boot_loaders = utils.get_supported_system_boot_loaders() if not set(boot_loaders_split).issubset(distro_boot_loaders): raise ValueError("Error with profile %s - not all boot_loaders %s are supported %s" % (self.name, boot_loaders_split, distro_boot_loaders)) self._boot_loaders = boot_loaders_split else: self._boot_loaders = []
def test_get_supported_system_boot_loaders(): # Arrange # Act result = utils.get_supported_system_boot_loaders() # Assert assert result == ["grub", "pxe", "yaboot", "ipxe"]
# this data structure is described in item.py FIELDS = [ # non-editable in UI (internal) ["ctime", 0, 0, "", False, "", 0, "float"], ["depth", 0, 0, "Depth", False, "", 0, "int"], ["mtime", 0, 0, "", False, "", 0, "float"], ["source_repos", [], 0, "Source Repos", False, "", 0, "list"], ["tree_build_time", 0, 0, "Tree Build Time", False, "", 0, "str"], ["uid", "", 0, "", False, "", 0, "str"], # editable in UI ["arch", 'x86_64', 0, "Architecture", True, "", utils.get_valid_archs(), "str"], ["autoinstall_meta", {}, 0, "Automatic Installation Template Metadata", True, "Ex: dog=fang agent=86", 0, "dict"], ["boot_files", {}, 0, "TFTP Boot Files", True, "Files copied into tftpboot beyond the kernel/initrd", 0, "list"], ["boot_loader", "<<inherit>>", 0, "Boot loader", True, "Network installation boot loader", utils.get_supported_system_boot_loaders(), "str"], ["breed", 'redhat', 0, "Breed", True, "What is the type of distribution?", utils.get_valid_breeds(), "str"], ["comment", "", 0, "Comment", True, "Free form text description", 0, "str"], ["fetchable_files", {}, 0, "Fetchable Files", True, "Templates for tftp or wget/curl", 0, "list"], ["initrd", None, 0, "Initrd", True, "Absolute path to kernel on filesystem", 0, "str"], ["kernel", None, 0, "Kernel", True, "Absolute path to kernel on filesystem", 0, "str"], ["kernel_options", {}, 0, "Kernel Options", True, "Ex: selinux=permissive", 0, "dict"], ["kernel_options_post", {}, 0, "Kernel Options (Post Install)", True, "Ex: clocksource=pit noapic", 0, "dict"], ["mgmt_classes", [], 0, "Management Classes", True, "Management classes for external config management", 0, "list"], ["name", "", 0, "Name", True, "Ex: Fedora-11-i386", 0, "str"], ["os_version", "virtio26", 0, "OS Version", True, "Needed for some virtualization optimizations", utils.get_valid_os_versions(), "str"], ["owners", "SETTINGS:default_ownership", 0, "Owners", True, "Owners list for authz_ownership (space delimited)", 0, "list"], ["template_files", {}, 0, "Template Files", True, "File mappings for built-in config management", 0, "list"] ]
[ "arch", 'x86_64', 0, "Architecture", True, "", utils.get_valid_archs(), "str" ], [ "autoinstall_meta", {}, 0, "Automatic Installation Template Metadata", True, "Ex: dog=fang agent=86", 0, "dict" ], [ "boot_files", {}, 0, "TFTP Boot Files", True, "Files copied into tftpboot beyond the kernel/initrd", 0, "list" ], [ "boot_loader", "<<inherit>>", 0, "Boot loader", True, "Network installation boot loader", utils.get_supported_system_boot_loaders(), "str" ], [ "breed", 'redhat', 0, "Breed", True, "What is the type of distribution?", utils.get_valid_breeds(), "str" ], [ "comment", "", 0, "Comment", True, "Free form text description", 0, "str" ], [ "fetchable_files", {}, 0, "Fetchable Files", True, "Templates for tftp or wget/curl", 0, "list" ], [
def set_boot_loader(self, name): if name not in utils.get_supported_system_boot_loaders(): raise CX(_("Invalid boot loader name: %s" % name)) self.boot_loader = name
# this data structure is described in item.py FIELDS = [ # non-editable in UI (internal) ["ctime", 0, 0, "", False, "", 0, "float"], ["depth", 0, 0, "Depth", False, "", 0, "int"], ["mtime", 0, 0, "", False, "", 0, "float"], ["source_repos", [], 0, "Source Repos", False, "", 0, "list"], ["tree_build_time", 0, 0, "Tree Build Time", False, "", 0, "str"], ["uid", "", 0, "", False, "", 0, "str"], # editable in UI ["arch", 'x86_64', 0, "Architecture", True, "", utils.get_valid_archs(), "str"], ["autoinstall_meta", {}, 0, "Automatic Installation Template Metadata", True, "Ex: dog=fang agent=86", 0, "dict"], ["boot_files", {}, 0, "TFTP Boot Files", True, "Files copied into tftpboot beyond the kernel/initrd", 0, "list"], ["boot_loader", "<<inherit>>", 0, "Boot loader", True, "Network installation boot loader", utils.get_supported_system_boot_loaders(), "str"], ["breed", 'redhat', 0, "Breed", True, "What is the type of distribution?", utils.get_valid_breeds(), "str"], ["comment", "", 0, "Comment", True, "Free form text description", 0, "str"], ["fetchable_files", {}, 0, "Fetchable Files", True, "Templates for tftp or wget/curl", 0, "list"], ["initrd", None, 0, "Initrd", True, "Absolute path to kernel on filesystem", 0, "str"], ["kernel", None, 0, "Kernel", True, "Absolute path to kernel on filesystem", 0, "str"], ["remote_boot_initrd", None, 0, "Remote Boot Initrd", True, "URL the bootloader directly retrieves and boots from", 0, "str"], ["remote_boot_kernel", None, 0, "Remote Boot Kernel", True, "URL the bootloader directly retrieves and boots from", 0, "str"], ["kernel_options", {}, 0, "Kernel Options", True, "Ex: selinux=permissive", 0, "dict"], ["kernel_options_post", {}, 0, "Kernel Options (Post Install)", True, "Ex: clocksource=pit noapic", 0, "dict"], ["mgmt_classes", [], 0, "Management Classes", True, "Management classes for external config management", 0, "list"], ["name", "", 0, "Name", True, "Ex: Fedora-11-i386", 0, "str"], ["os_version", "virtio26", 0, "OS Version", True, "Needed for some virtualization optimizations", utils.get_valid_os_versions(), "str"], ["owners", "SETTINGS:default_ownership", 0, "Owners", True, "Owners list for authz_ownership (space delimited)", 0, "list"], ["redhat_management_key", "", "", "Redhat Management Key", True, "Registration key for RHN, Spacewalk, or Satellite", 0, "str"], ["template_files", {}, 0, "Template Files", True, "File mappings for built-in config management", 0, "list"]
def set_boot_loader(self, name): if name not in utils.get_supported_system_boot_loaders(): raise CX(_("Invalid boot loader name: %s" % name)) self.boot_loader = name