7.1.1.1.1. cobbler.actions.buildiso package

7.1.1.1.1.1. Submodules

7.1.1.1.1.2. cobbler.actions.buildiso.append_line module

Module to centralize the generation of kernel options for custom built ISOs.

class cobbler.actions.buildiso.append_line.AppendLineBuilder(api: CobblerAPI, distro_name: str, data: Dict[str, Any])[source]

Bases: object

This class is meant to be initiated for a single append line. Afterwards the object should be disposed.

add_remaining_kopts(kopts: Dict[str, str | List[str]]) None[source]

Add remaining kernel_options to append_line :param kopts: The kernel options which are not present in append_line. :return: A single line with all kernel options from the dictionary in the string. Starts with a space.

generate_profile(distro_breed: str, os_version: str, protocol: str = 'http') str[source]

Generate the append line for the kernel for a network installation. :param distro_breed: The name of the distribution breed. :param os_version: The OS version of the distribution. :param protocol: The scheme that is used to read the autoyast file from the server :return: The generated append line.

generate_standalone(data: Dict[Any, Any], distro: Distro, descendant: Profile | System) str[source]

Generates the append line for the kernel so the installation can be done unattended. :param data: The values for the append line. The key “kernel_options” must be present. :param distro: The distro object to generate the append line from. :param descendant: The profile or system which is underneath the distro. :return: The base append_line which we need for booting the built ISO. Contains initrd and autoinstall parameter.

generate_system(dist: Distro, system: System, exclude_dns: bool, scheme: str = 'http') str[source]

Generate the append-line for a net-booting system.

Parameters:
  • dist – The distribution associated with the system.

  • system – The system itself

  • exclude_dns – Whether to include the DNS config or not.

  • scheme – The scheme that is used to read the autoyast file from the server

7.1.1.1.1.3. cobbler.actions.buildiso.netboot module

This module contains the specific code to generate a network bootable ISO.

class cobbler.actions.buildiso.netboot.NetbootBuildiso(api: CobblerAPI)[source]

Bases: BuildIso

This class contains all functionality related to building network installation images.

make_shorter(distname: str) str[source]

Return a short distro identifier which is basically an internal counter which is mapped via the real distro name.

Parameters:

distname – The distro name to return an identifier for.

Returns:

A short distro identifier

run(iso: str = 'autoinst.iso', buildisodir: str = '', profiles: List[Profile] | None = None, xorrisofs_opts: str = '', distro: Distro | None = None, systems: List[System] | None = None, exclude_dns: bool = False, esp: str | None = None, exclude_systems: bool = False, **kwargs: Any)[source]

Generate a net-installer for a distribution.

By default, the ISO includes all available systems and profiles. Specify profiles and systems to only include the selected systems and profiles. Both parameters can be provided at the same time.

Parameters:
  • iso – The name of the iso. Defaults to “autoinst.iso”.

  • buildisodir – This overwrites the directory from the settings in which the iso is built in.

  • profiles – The filter to generate the ISO only for selected profiles.

  • xorrisofs_optsxorrisofs options to include additionally.

  • distro – For detecting the architecture of the ISO. If not provided, taken from first profile or system item

  • systems – The filter to generate the ISO only for selected systems.

  • exclude_dns – Whether the repositories have to be locally available or the internet is reachable.

  • exclude_systems – Whether system entries should not be exported.

7.1.1.1.1.4. cobbler.actions.buildiso.standalone module

This module contains the specific code for generating standalone or airgapped ISOs.

class cobbler.actions.buildiso.standalone.StandaloneBuildiso(api: CobblerAPI)[source]

Bases: BuildIso

This class contains all functionality related to building self-contained installation images.

run(iso: str = 'autoinst.iso', buildisodir: str = '', profiles: List[Profile] | None = None, systems: List[System] | None = None, xorrisofs_opts: str = '', distro: Distro | None = None, airgapped: bool = False, source: str = '', esp: str | None = None, exclude_systems: bool = False, **kwargs: Any)[source]

Run the whole iso generation from bottom to top. Per default this builds an ISO for all available systems and profiles. This is the only method which should be called from non-class members. The profiles and system parameters can be combined.

Parameters:
  • iso – The name of the iso. Defaults to “autoinst.iso”.

  • buildisodir – This overwrites the directory from the settings in which the iso is built in.

  • profiles – The filter to generate the ISO only for selected profiles. None means all.

  • systems – The filter to generate the ISO only for selected systems. None means all.

  • xorrisofs_optsxorrisofs options to include additionally.

  • distro – For detecting the architecture of the ISO. If not provided, taken from first profile or system item.

  • airgapped – This option implies standalone=True.

  • source – If the iso should be offline available this is the path to the sources of the image.

  • exclude_systems – Whether system entries should not be exported.

validate_repos(profile_name: str, repo_names: List[str], repo_mirrordir: Path)[source]

Sanity checks for repos to sync.

This function checks that repos are known to cobbler and have a local mirror directory. Raises ValueError if any repo fails the validation.

7.1.1.1.1.5. Module contents

Builds bootable CD images that have PXE-equivalent behavior for all Cobbler distros/profiles/systems currently in memory.

class cobbler.actions.buildiso.Autoinstall(config, repos)[source]

Bases: NamedTuple

config: str

Alias for field number 0

repos: List[str]

Alias for field number 1

class cobbler.actions.buildiso.BootFilesCopyset(src_kernel, src_initrd, new_filename)[source]

Bases: NamedTuple

new_filename: str

Alias for field number 2

src_initrd: str

Alias for field number 1

src_kernel: str

Alias for field number 0

class cobbler.actions.buildiso.BuildIso(api: CobblerAPI)[source]

Bases: object

Handles conversion of internal state to the isolinux tree layout

calculate_grub_name(desired_arch: Archs) str[source]

This function checks the bootloaders_formats in our settings and then checks if there is a match between the architectures and the distribution architecture. :param distro: The distribution to get the GRUB2 loader name for.

create_buildiso_dirs_ppc64le(buildiso_root: str) BuildisoDirsPPC64LE[source]

Create directories in the buildiso root.

Layout: . ├── autoinstall ├── boot ├── ppc └── repo_mirror

create_buildiso_dirs_x86_64(buildiso_root: str) BuildisoDirsX86_64[source]

Create directories in the buildiso root.

Layout: . ├── autoinstall ├── EFI │ └── BOOT ├── isolinux └── repo_mirror

distmap: Dict[str, str]
filter_profiles(selected_items: List[Profile] | None = None) List[Profile][source]

Return a list of valid profile objects, or everything if selected_items is empty.

Parameters:

selected_items – The profiles to include in the returned list. Everything is returned if empty/None.

Returns:

A list of valid profiles.

filter_systems(selected_items: List[System] | None = None) List[System][source]

Return a list of valid system objects, or everything if selected_items is empty.

Parameters:

selected_items – The systems to include in the returned list. Everything is returned if empty/None.

Returns:

A list of valid systems.

prepare_sources(distro: Distro | None, profiles: List[Profile] | None, systems: List[System] | None, exclude_systems: bool) Tuple[Distro, List[Profile], List[System]][source]

Preprocess input data to suitable format.

If distro is not provided, it is taken from first profile or system item. Profiles and systems are returned either as empty list or list of Profile, resp. System

Parameters:
  • distro – The distribution to use, or None to autodetect from the given profiles/systems.

  • profiles – List of profiles to include, or None to include all.

  • systems – List of systems to include, or None to include all.

  • exclude_systems – If set, do not include any system

Raises:

ValueError – In case of unsupported distro architecture

Returns:

Tuple with Distro, List of profiles and List of systems

class cobbler.actions.buildiso.BuildisoDirsPPC64LE(root, grub, ppc, autoinstall, repo)[source]

Bases: NamedTuple

autoinstall: Path

Alias for field number 3

grub: Path

Alias for field number 1

ppc: Path

Alias for field number 2

repo: Path

Alias for field number 4

root: Path

Alias for field number 0

class cobbler.actions.buildiso.BuildisoDirsX86_64(root, isolinux, grub, autoinstall, repo)[source]

Bases: NamedTuple

autoinstall: Path

Alias for field number 3

grub: Path

Alias for field number 2

isolinux: Path

Alias for field number 1

repo: Path

Alias for field number 4

root: Path

Alias for field number 0

class cobbler.actions.buildiso.LoaderCfgsParts(isolinux, grub, bootfiles_copysets)[source]

Bases: NamedTuple

bootfiles_copysets: List[BootFilesCopyset]

Alias for field number 2

grub: List[str]

Alias for field number 1

isolinux: List[str]

Alias for field number 0