def make_pxe_menu(self): """ Generates both pxe and grub boot menus. """ # only do this if there is NOT a system named default. default = self.systems.find(name="default") if default is None: timeout_action = "local" else: timeout_action = default.profile menu_items = self.get_menu_items() # Write the PXE menu: metadata = {"pxe_menu_items": menu_items['pxe'], "pxe_timeout_profile": timeout_action} outfile = os.path.join(self.bootloc, "pxelinux.cfg", "default") template_src = open(os.path.join(self.settings.boot_loader_conf_template_dir, "pxedefault.template")) template_data = template_src.read() self.templar.render(template_data, metadata, outfile, None) template_src.close() # Write the grub menu: for arch in utils.get_valid_archs(): arch_menu_items = self.get_menu_items(arch) if(arch_menu_items['grub']): outfile = os.path.join(self.bootloc, "grub", "{0}_menu_items.cfg".format(arch)) fd = open(outfile, "w+") fd.write(arch_menu_items['grub']) fd.close()
from cobbler.cexceptions import CX from cobbler.utils import _ # 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"]
from cobbler import grub # 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" ], [
# validation fields in is_valid to check to see that two seperate fields do not conflict, but in general # design issues that require this should be avoided forever more, and there are few exceptions. Cobbler # must operate as normal with the default value for all fields and not choke on the default values. FIELDS = [ ["name", "", 0, "Name", True, "Ex: Fedora-11-i386", 0, "str"], ["ctime", 0, 0, "", False, "", 0, "float"], ["mtime", 0, 0, "", False, "", 0, "float"], ["uid", "", 0, "", False, "", 0, "str"], ["owners", "SETTINGS:default_ownership", 0, "Owners", True, "Owners list for authz_ownership (space delimited)", 0, "list"], ["kernel", None, 0, "Kernel", True, "Absolute path to kernel on filesystem", 0, "str"], ["initrd", None, 0, "Initrd", 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"], ["ks_meta", {}, 0, "Kickstart Metadata", True, "Ex: dog=fang agent=86", 0, "dict"], ["arch", 'x86_64', 0, "Architecture", True, "", utils.get_valid_archs(), "str"], ["breed", 'redhat', 0, "Breed", True, "What is the type of distribution?", utils.get_valid_breeds(), "str"], ["os_version", "generic26", 0, "OS Version", True, "Needed for some virtualization optimizations", utils.get_valid_os_versions(), "str"], ["source_repos", [], 0, "Source Repos", False, "", 0, "list"], ["depth", 0, 0, "Depth", False, "", 0, "int"], ["comment", "", 0, "Comment", True, "Free form text description", 0, "str"], ["tree_build_time", 0, 0, "Tree Build Time", False, "", 0, "str"], ["mgmt_classes", [], 0, "Management Classes", True, "Management classes for external config management", 0, "list"], ["boot_files", {}, 0, "TFTP Boot Files", True, "Files copied into tftpboot beyond the kernel/initrd", 0, "list"], ["fetchable_files", {}, 0, "Fetchable Files", True, "Templates for tftp or wget", 0, "list"], ["template_files", {}, 0, "Template Files", True, "File mappings for built-in config management", 0, "list"] ] class Distro(item.Item): """