API Documentation 9.17.39

Subpackages

Submodules

kiwi.app Module

class kiwi.app.App[source]

Bases: object

Implements creation of task instances

Each task class implements a process method which is called when constructing an instance of App

kiwi.cli Module

class kiwi.cli.Cli[source]

Bases: object

Implements the main command line interface

An instance of the Cli class builds the entry point for the application and implements methods to load further command plugins which itself provides their own command line interface

get_command()[source]

Extract selected command name

Returns

command name

Return type

str

get_command_args()[source]

Extract argument dict for selected command

Returns

Contains dictionary of command arguments

{
    '--command-option': 'value'
}

Return type

dict

get_global_args()[source]

Extract argument dict for global arguments

Returns

Contains dictionary of global arguments

{
    '--global-option': 'value'
}

Return type

dict

get_servicename()[source]

Extract service name from argument parse result

Returns

service name

Return type

str

invoke_kiwicompat(compat_args)[source]

Execute kiwicompat with provided legacy KIWI command line arguments

Example:

invoke_kiwicompat(
    '--build', 'description', '--type', 'vmx',
    '-d', 'destination'
)
Parameters

compat_args (list) – legacy kiwi command arguments

load_command()[source]

Loads task class plugin according to service and command name

Returns

importlib loaded module

Return type

object

show_and_exit_on_help_request()[source]

Execute man to show the selected manual page

kiwi.command Module

class kiwi.command.Command[source]

Bases: object

Implements command invocation

An instance of Command provides methods to invoke external commands in blocking and non blocking mode. Control of stdout and stderr is given to the caller

static call(command, custom_env=None)[source]

Execute a program and return an io file handle pair back. stdout and stderr are both on different channels. The caller must read from the output file handles in order to actually run the command. This can be done using the CommandIterator from command_process

Example:

process = Command.call(['ls', '-l'])
Parameters
  • command (list) – command and arguments

  • custom_env (list) – custom os.environ

Returns

Contains process results in command type

command(
    output='string', output_available=bool,
    error='string', error_available=bool,
    process=subprocess
)

Return type

namedtuple

static run(command, custom_env=None, raise_on_error=True)[source]

Execute a program and block the caller. The return value is a hash containing the stdout, stderr and return code information. Unless raise_on_error is set to false an exception is thrown if the command exits with an error code not equal to zero

Example:

result = Command.run(['ls', '-l'])
Parameters
  • command (list) – command and arguments

  • custom_env (list) – custom os.environ

  • raise_on_error (bool) – control error behaviour

Returns

Contains call results in command type

command(output='string', error='string', returncode=int)

Return type

namedtuple

kiwi.command_process Module

class kiwi.command_process.CommandIterator(command)[source]

Bases: object

Implements an Iterator for Instances of Command

Parameters

command (subprocess) – instance of subprocess

get_error_code()[source]

Provide return value from processed command

Returns

errorcode

Return type

int

get_error_output()[source]

Provide data which was sent to the stderr channel

Returns

stderr data

Return type

str

get_pid()[source]

Provide process ID of command while running

Returns

pid

Return type

int

kill()[source]

Send kill signal SIGTERM to command process

class kiwi.command_process.CommandProcess(command, log_topic='system')[source]

Bases: object

Implements processing of non blocking Command calls

Provides methods to iterate over non blocking instances of the Command class with and without progress information

Parameters
  • command (subprocess) – instance of subprocess

  • log_topic (string) – topic string for logging

create_match_method(method)[source]

create a matcher function pointer which calls the given method as method(item_to_match, data) on dereference

Parameters

method (function) – function reference

Returns

function pointer

Return type

object

poll()[source]

Iterate over process, raise on error and log output

poll_and_watch()[source]

Iterate over process don’t raise on error and log stdout and stderr

poll_show_progress(items_to_complete, match_method)[source]

Iterate over process and show progress in percent raise on error and log output

Parameters
  • items_to_complete (list) – all items

  • match_method (function) – method matching item

returncode()[source]

kiwi.defaults Module

class kiwi.defaults.Defaults[source]

Bases: object

Implements default values

Provides static methods for default values and state information

get(key)[source]

Implements get method for profile elements

Parameters

key (string) – profile keyname

Returns

key value

Return type

str

static get_archive_image_types()[source]

Provides list of supported archive image types

Returns

archive names

Return type

list

static get_boot_image_description_path()[source]

Provides the path to find custom kiwi boot descriptions

Returns

directory path

Return type

str

static get_boot_image_strip_file()[source]

Provides the file path to bootloader strip metadata. This file contains information about the files and directories automatically striped out from the kiwi initrd

Returns

file path

Return type

str

static get_buildservice_env_name()[source]

Provides the base name of the environment file in a buildservice worker

Returns

file basename

Return type

str

static get_common_functions_file()[source]

Provides the file path to config functions metadata.

This file contains bash functions used for system configuration or in the boot code from the kiwi initrd

Returns

file path

Return type

str

static get_container_base_image_tag()[source]

Provides the tag used to identify base layers during the build of derived images.

Returns

tag

Return type

str

static get_container_compression()[source]

Provides default container compression algorithm

Returns

name

Return type

str

static get_container_image_types()[source]

Provides list of supported container image types

Returns

container names

Return type

list

static get_custom_rpm_bootstrap_macro_name()[source]

Returns the rpm bootstrap macro file name created in the custom rpm macros path

Returns

filename

Return type

str

static get_custom_rpm_image_macro_name()[source]

Returns the rpm image macro file name created in the custom rpm macros path

Returns

filename

Return type

str

static get_custom_rpm_macros_path()[source]

Returns the custom macros directory for the rpm database.

Returns

path name

Return type

str

static get_default_boot_mbytes()[source]

Provides default boot partition size in mbytes

Returns

mbsize value

Return type

int

static get_default_boot_timeout_seconds()[source]

Provides default boot timeout in seconds

Returns

seconds

Return type

int

static get_default_container_created_by()[source]

Provides the default ‘created by’ history entry for containers.

Returns

the specific kiwi version used for the build

Return type

str

static get_default_container_name()[source]

Provides the default container name.

Returns

name

Return type

str

static get_default_container_subcommand()[source]

Provides the default container subcommand.

Returns

command as a list of arguments

Return type

list

static get_default_container_tag()[source]

Provides the default container tag.

Returns

tag

Return type

str

static get_default_disk_start_sector()[source]

Provides the default initial disk sector for the first disk partition.

Returns

sector value

Return type

int

static get_default_efi_boot_mbytes()[source]

Provides default EFI partition size in mbytes

Returns

mbsize value

Return type

int

static get_default_efi_partition_table_type()[source]

Provides the default partition table type for efi firmwares.

Returns

partition table type name

Return type

str

static get_default_firmware(arch)[source]

Provides default firmware for specified architecture

Parameters

arch (string) – platform.machine

Returns

firmware name

Return type

str

static get_default_inode_size()[source]

Provides default size of inodes in bytes. This is only relevant for inode based filesystems

Returns

bytesize value

Return type

int

static get_default_legacy_bios_mbytes()[source]

Provides default size of bios_grub partition in mbytes

Returns

mbsize value

Return type

int

static get_default_live_iso_root_filesystem()[source]

Provides default live iso root filesystem type

Returns

filesystem name

Return type

str

static get_default_live_iso_type()[source]

Provides default live iso union type

Returns

live iso type

Return type

str

static get_default_packager_tool(package_manager)[source]

Provides the packager tool according to the package manager

Parameters

package_manager (string) – package manger name

Returns

packager tool binary name

Return type

str

static get_default_prep_mbytes()[source]

Provides default size of prep partition in mbytes

Returns

mbsize value

Return type

int

static get_default_uri_type()[source]

Provides default URI type

Absolute path specifications used in the context of an URI will apply the specified default mime type

Returns

URI mime type

Return type

str

static get_default_video_mode()[source]

Provides 800x600 default video mode as hex value for the kernel

Returns

vesa video kernel hex value

Return type

str

static get_default_volume_group_name()[source]

Provides default LVM volume group name

Returns

name

Return type

str

static get_disk_format_types()[source]

Provides supported disk format types

Returns

disk types

Return type

list

static get_disk_image_types()[source]

Provides supported disk image types

Returns

disk image type names

Return type

list

static get_dracut_conf_name()[source]

Provides file path of dracut config file to be used with KIWI

Returns

file path name

Return type

str

static get_ec2_capable_firmware_names()[source]

Provides list of EC2 capable firmware names. These are those for which kiwi supports the creation of disk images bootable within the Amazon EC2 public cloud

Returns

firmware names

Return type

list

static get_efi_capable_firmware_names()[source]

Provides list of EFI capable firmware names. These are those for which kiwi supports the creation of an EFI bootable disk image

Returns

firmware names

Return type

list

static get_efi_image_name(arch)[source]

Provides architecture specific EFI boot binary name

Parameters

arch (string) – platform.machine

Returns

name

Return type

str

static get_efi_module_directory_name(arch)[source]

Provides architecture specific EFI directory name which stores the EFI binaries for the desired architecture.

Parameters

arch (string) – platform.machine

Returns

directory name

Return type

str

static get_exclude_list_for_root_data_sync()[source]

Provides the list of files or folders that are created by KIWI for its own purposes. Those files should be not be included in the resulting image.

Returns

list of file and directory names

Return type

list

static get_failsafe_kernel_options()[source]

Provides failsafe boot kernel options

Returns

list of kernel options

['option=value', 'option']

Return type

list

static get_filesystem_image_types()[source]

Provides list of supported filesystem image types

Returns

filesystem names

Return type

list

static get_firmware_types()[source]

Provides supported architecture specific firmware types

Returns

firmware types per architecture

Return type

dict

static get_grub_basic_modules(multiboot)[source]

Provides list of basic grub modules

Parameters

multiboot (bool) – grub multiboot mode

Returns

list of module names

Return type

list

static get_grub_bios_modules(multiboot=False)[source]

Provides list of grub bios modules

Parameters

multiboot (bool) – grub multiboot mode

Returns

list of module names

Return type

list

static get_grub_boot_directory_name(lookup_path)[source]

Provides grub2 data directory name in boot/ directory

Depending on the distribution the grub2 boot path could be either boot/grub2 or boot/grub. The method will decide for the correct base directory name according to the name pattern of the installed grub2 tools

Returns

directory basename

Return type

str

static get_grub_efi_modules(multiboot=False)[source]

Provides list of grub efi modules

Parameters

multiboot (bool) – grub multiboot mode

Returns

list of module names

Return type

list

static get_grub_ofw_modules()[source]

Provides list of grub ofw modules (ppc)

Returns

list of module names

Return type

list

static get_grub_path(root_path, filename, raise_on_error=True)[source]

Provides grub path to given search file

Depending on the distribution grub could be installed below a grub2 or grub directory. grub could also reside in /usr/lib as well as in /usr/share. Therefore this information needs to be dynamically looked up

Parameters
  • root_path (string) – root path to start the lookup from

  • filename (string) – filename to search

  • raise_on_error (bool) – raise on not found, defaults to True

The method returns the path to the given grub search file. By default it raises a KiwiBootLoaderGrubDataError exception if the file could not be found in any of the search locations. If raise_on_error is set to False and no file could be found the function returns None

Returns

filepath

Return type

str

static get_imported_root_image(root_dir)[source]

Provides the path to an imported root system image

If the image description specified a derived_from attribute the file from this attribute is copied into the root_dir using the name as provided by this method

Parameters

root_dir (string) – image root directory

Returns

file path name

Return type

str

static get_install_volume_id()[source]

Provides default value for ISO volume ID for install media

Returns

name

Return type

str

static get_iso_boot_path()[source]

Provides arch specific relative path to boot files on kiwi iso filesystems

Returns

relative path name

Return type

str

static get_iso_tool_category()[source]

Provides default iso tool category

Returns

name

Return type

str

static get_live_dracut_module_from_flag(flag_name)[source]

Provides flag_name to dracut module name map

Depending on the value of the flag attribute in the KIWI image description a specific dracut module needs to be selected

Returns

dracut module name

Return type

str

static get_live_image_types()[source]

Provides supported live image types

Returns

live image type names

Return type

list

static get_live_iso_persistent_boot_options(persistent_filesystem=None)[source]

Provides list of boot options passed to the dracut kiwi-live module to setup persistent writing

Returns

list of boot options

Return type

list

static get_lvm_overhead_mbytes()[source]

Provides empiric LVM overhead size in mbytes

Returns

mbsize value

Return type

int

static get_min_volume_mbytes()[source]

Provides default minimum LVM volume size in mbytes

Returns

mbsize value

Return type

int

static get_network_image_types()[source]

Provides supported pxe image types

Returns

pxe image type names

Return type

list

static get_obs_download_server_url()[source]

Provides the default download server url hosting the public open buildservice repositories

Returns

url path

Return type

str

static get_oci_archive_tool()[source]

Provides the default OCI archive tool name.

Returns

name

Return type

str

static get_preparer()[source]

Provides ISO preparer name

Returns

name

Return type

str

static get_publisher()[source]

Provides ISO publisher name

Returns

name

Return type

str

static get_recovery_spare_mbytes()[source]

Provides spare size of recovery partition in mbytes

Returns

mbsize value

Return type

int

static get_s390_disk_block_size()[source]

Provides the default block size for s390 storage disks

Returns

blocksize value

Return type

int

static get_s390_disk_type()[source]

Provides the default disk type for s390 storage disks

Returns

type name

Return type

str

static get_schema_file()[source]

Provides file path to kiwi RelaxNG schema

Returns

file path

Return type

str

static get_shared_cache_location()[source]

Provides the shared cache location

This is a directory which shares data from the image buildsystem host with the image root system. The location is returned as an absolute path stripped off by the leading ‘/’. This is because the path is transparently used on the host /<cache-dir> and inside of the image imageroot/<cache-dir>

Returns

directory path

Return type

str

static get_shim_loader(root_path)[source]

Provides shim loader file path

Searches distribution specific locations to find shim.efi below the given root path

Parameters

root_path (string) – image root path

Returns

file path or None

Return type

str

static get_shim_vendor_directory(root_path)[source]

Provides shim vendor directory

Searches distribution specific locations to find shim.efi below the given root path and return the directory name to the file found

Parameters

root_path (string) – image root path

Returns

directory path or None

Return type

str

static get_signed_grub_loader(root_path)[source]

Provides shim signed grub loader file path

Searches distribution specific locations to find grub.efi below the given root path

Parameters

root_path (string) – image root path

Returns

file path or None

Return type

str

static get_snapper_config_template_file()[source]

Provides the default configuration template file for snapper

Returns

file

Return type

str

static get_solvable_location()[source]

Provides the directory to store SAT solvables for repositories. The solvable files are used to perform package dependency and metadata resolution

Returns

directory path

Return type

str

static get_unsigned_grub_loader(root_path)[source]

Provides unsigned grub efi loader file path

Searches distribution specific locations to find grub.efi below the given root path

Parameters

root_path (string) – image root path

Returns

file path or None

Return type

str

static get_vagrant_config_virtualbox_guest_additions()[source]

Provides the default value for vagrantconfig.virtualbox_guest_additions_present

Returns

whether guest additions are expected to be present in the vagrant box

Return type

bool

static get_video_mode_map()[source]

Provides video mode map

Assign a tuple to each kernel vesa hex id for each of the supported bootloaders

Returns

video type map

{'kernel_hex_mode': video_type(grub2='mode', isolinux='mode')}

Return type

dict

static get_volume_id()[source]

Provides default value for ISO volume ID

Returns

name

Return type

str

static get_xsl_stylesheet_file()[source]

Provides the file path to the KIWI XSLT style sheets

Returns

file path

Return type

str

static get_xz_compression_options()[source]

Provides compression options for the xz compressor

Returns

Contains list of options

['--option=value']

Return type

list

static is_buildservice_worker()[source]

Checks if build host is an open buildservice machine

The presence of /.buildenv on the build host indicates we are building inside of the open buildservice

Returns

True if obs worker, else False

Return type

bool

static project_file(filename)[source]

Provides the python module base directory search path

The method uses the resource_filename method to identify files and directories from the application

Parameters

filename (string) – relative project file

Returns

absolute file path name

Return type

str

static set_python_default_encoding_to_utf8()[source]

Set python default encoding to utf-8 if not already done

This is not a safe operation since sys.setdefaultencoding() was removed from sys on purpose when Python starts. Reenabling it and changing the default encoding can break code that relies on ascii being the default. Within the scope of kiwi the operation is safe because all data is expected to be utf-8 everywhere and considered a bug if this is not the case

to_profile(profile)[source]

Implements method to add list of profile keys and their values to the specified instance of a Profile class

Parameters

profile (object) – Profile instance

kiwi.exceptions Module

exception kiwi.exceptions.KiwiArchiveSetupError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if an unsupported image archive type is used.

exception kiwi.exceptions.KiwiArchiveTarError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if impossible to determine which tar command version is installed on the underlying system

exception kiwi.exceptions.KiwiBootImageDumpError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if an instance of BootImage* can not be serialized on as file via pickle dump

exception kiwi.exceptions.KiwiBootImageSetupError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if an unsupported initrd system type is used.

exception kiwi.exceptions.KiwiBootLoaderConfigSetupError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if a configuration for an unsupported bootloader is requested.

exception kiwi.exceptions.KiwiBootLoaderGrubDataError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if no grub installation was found.

exception kiwi.exceptions.KiwiBootLoaderGrubFontError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if no grub unicode font was found.

exception kiwi.exceptions.KiwiBootLoaderGrubInstallError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if grub install to master boot record has failed.

exception kiwi.exceptions.KiwiBootLoaderGrubModulesError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the synchronisation of modules from the grub installation to the boot space has failed.

exception kiwi.exceptions.KiwiBootLoaderGrubPlatformError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if an attempt was made to use grub on an unsupported platform.

exception kiwi.exceptions.KiwiBootLoaderGrubSecureBootError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the Microsoft signed shim loader or grub2 loader could not be found in the image root system

exception kiwi.exceptions.KiwiBootLoaderInstallSetupError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if an installation for an unsupported bootloader is requested.

exception kiwi.exceptions.KiwiBootLoaderIsoLinuxPlatformError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if an attempt was made to use isolinux on an unsupported platform.

exception kiwi.exceptions.KiwiBootLoaderTargetError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the target to read the bootloader path from is not a disk or an iso image.

exception kiwi.exceptions.KiwiBootLoaderZiplInstallError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the installation of zipl has failed.

exception kiwi.exceptions.KiwiBootLoaderZiplPlatformError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if a configuration for an unsupported zipl architecture is requested.

exception kiwi.exceptions.KiwiBootLoaderZiplSetupError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the data set to configure the zipl bootloader is incomplete.

exception kiwi.exceptions.KiwiBootStrapPhaseFailed(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the bootstrap phase of the system prepare command has failed.

exception kiwi.exceptions.KiwiBuildahError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised on inconsistent buildah class calls

exception kiwi.exceptions.KiwiBundleError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the system bundle command has failed.

exception kiwi.exceptions.KiwiCommandCapabilitiesError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception is raised when some the CommandCapabilities methods fails, usually meaning there is some issue trying to parse some command output.

exception kiwi.exceptions.KiwiCommandError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if an external command called via a Command instance has returned with an exit code != 0 or could not be called at all.

exception kiwi.exceptions.KiwiCommandNotFound(message)[source]

Bases: kiwi.exceptions.KiwiCommandError

Exception raised if any executable command cannot be found in the evironment PATH variable.

exception kiwi.exceptions.KiwiCommandNotLoaded(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if a kiwi command task module could not be loaded.

exception kiwi.exceptions.KiwiCompatError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the given kiwi compatibility command line could not be understood by the compat option parser.

exception kiwi.exceptions.KiwiCompressionFormatUnknown(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the compression format of the data could not be detected.

exception kiwi.exceptions.KiwiConfigFileNotFound(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if no kiwi XML description was found.

exception kiwi.exceptions.KiwiContainerBuilderError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception is raised when something fails during a container image build procedure.

exception kiwi.exceptions.KiwiContainerImageSetupError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if an attempt to create a container instance for an unsupported container type is performed.

exception kiwi.exceptions.KiwiContainerSetupError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if an error in the creation of the container archive happened.

exception kiwi.exceptions.KiwiDataStructureError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the XML description failed to parse the data structure.

exception kiwi.exceptions.KiwiDebootstrapError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if not enough user data to call debootstrap were provided or the debootstrap has failed.

exception kiwi.exceptions.KiwiDecodingError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception is raised on decoding literals failure

exception kiwi.exceptions.KiwiDescriptionConflict(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if both, a description file and xml_content is provided

exception kiwi.exceptions.KiwiDescriptionInvalid(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the XML description failed to validate the XML schema.

exception kiwi.exceptions.KiwiDeviceProviderError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if a storage provide is asked for its managed device but no such device exists.

exception kiwi.exceptions.KiwiDiskBootImageError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if a kiwi boot image does not provide the requested data, e.g kernel, or hypervisor files.

exception kiwi.exceptions.KiwiDiskFormatSetupError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if an attempt was made to create a disk format instance of an unsupported disk format.

exception kiwi.exceptions.KiwiDiskGeometryError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the disk geometry (partition table) could not be read or evaluated against their expected geometry and capabilities.

exception kiwi.exceptions.KiwiDistributionNameError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the distribution name could not be found. The information is extracted from the boot attribute of the XML description. If no boot attribute is present or does not match the naming conventions the exception is raised.

exception kiwi.exceptions.KiwiError(message)[source]

Bases: Exception

Base class to handle all known exceptions

Specific exceptions are implemented as sub classes of KiwiError

Attributes

Parameters

message (string) – Exception message text

exception kiwi.exceptions.KiwiExtensionError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if an extension section of the same namespace is used multiple times as toplevel section within the extension section. Each extension must have a single toplevel entry point qualified by its namespace

exception kiwi.exceptions.KiwiFileAccessError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if accessing a file or its metadata failed

exception kiwi.exceptions.KiwiFileNotFound(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the requested file could not be found.

exception kiwi.exceptions.KiwiFileSystemSetupError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if an attempt was made to build an unsupported or unspecified filesystem.

exception kiwi.exceptions.KiwiFileSystemSyncError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the data sync from the system into the loop mounted filesystem image failed.

exception kiwi.exceptions.KiwiFormatSetupError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the requested disk format could not be created.

exception kiwi.exceptions.KiwiHelpNoCommandGiven(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the request for the help page is executed without a command to show the help for.

exception kiwi.exceptions.KiwiImageResizeError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the request to resize a disk image failed. Reasons could be a missing raw disk reference or a wrong size specification.

exception kiwi.exceptions.KiwiImportDescriptionError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the XML description data and scripts could not be imported into the root of the image.

exception kiwi.exceptions.KiwiInstallBootImageError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the required files to boot an installation image could not be found, e.g kernel or hypervisor.

exception kiwi.exceptions.KiwiInstallMediaError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if a request for an installation media is made but the system image type is not an oem type.

exception kiwi.exceptions.KiwiInstallPhaseFailed(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the install phase of a system prepare command has failed.

exception kiwi.exceptions.KiwiIsoLoaderError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if no isolinux loader file could be found.

exception kiwi.exceptions.KiwiIsoMetaDataError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if an inconsistency in the ISO header was found such like invalid eltorito specification or a broken path table.

exception kiwi.exceptions.KiwiIsoToolError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if an iso helper tool such as isoinfo could not be found on the build system.

exception kiwi.exceptions.KiwiKernelLookupError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the search for the kernel image file failed

exception kiwi.exceptions.KiwiLiveBootImageError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if an attempt was made to use an unsupported live iso type.

exception kiwi.exceptions.KiwiLoadCommandUndefined(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if no command is specified for a given service on the commandline.

exception kiwi.exceptions.KiwiLogFileSetupFailed(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the log file could not be created.

exception kiwi.exceptions.KiwiLoopSetupError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if not enough user data to create a loop device is specified.

exception kiwi.exceptions.KiwiLuksSetupError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if not enough user data is provided to setup the luks encryption on the given device.

exception kiwi.exceptions.KiwiMappedDeviceError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the device to become mapped does not exist.

exception kiwi.exceptions.KiwiMountKernelFileSystemsError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if a kernel filesystem such as proc or sys could not be mounted.

exception kiwi.exceptions.KiwiMountSharedDirectoryError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the host <-> image shared directory could not be mounted.

exception kiwi.exceptions.KiwiNotImplementedError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if a functionality is not yet implemented.

exception kiwi.exceptions.KiwiOCIArchiveToolError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the requested OCI archive tool is not supported

exception kiwi.exceptions.KiwiPackageManagerSetupError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if an attempt was made to create a package manager instance for an unsupported package manager.

exception kiwi.exceptions.KiwiPackagesDeletePhaseFailed(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the packages deletion phase in system prepare fails.

exception kiwi.exceptions.KiwiPartitionerGptFlagError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if an attempt was made to set an unknown partition flag for an entry in the GPT table.

exception kiwi.exceptions.KiwiPartitionerMsDosFlagError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if an attempt was made to set an unknown partition flag for an entry in the MSDOS table.

exception kiwi.exceptions.KiwiPartitionerSetupError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if an attempt was made to create an instance of a partitioner for an unsupporte partitioner.

exception kiwi.exceptions.KiwiPrivilegesError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if root privileges are required but not granted.

exception kiwi.exceptions.KiwiProfileNotFound(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if a specified profile does not exist in the XML configuration.

exception kiwi.exceptions.KiwiPxeBootImageError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if a required boot file e.g the kernel could not be found in the process of building a pxe image.

exception kiwi.exceptions.KiwiRaidSetupError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if invalid or not enough user data is provided to create a raid array on the specified storage device.

exception kiwi.exceptions.KiwiRepositorySetupError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if an attempt was made to create an instance of a repository for an unsupported package manager.

exception kiwi.exceptions.KiwiRequestError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if a package request could not be processed by the corresponding package manager instance.

exception kiwi.exceptions.KiwiRequestedTypeError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if an attempt was made to build an image for an unsupported image type.

exception kiwi.exceptions.KiwiResizeRawDiskError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if an attempt was made to resize the image disk to a smaller size than the current one. Simply shrinking a disk image file is not possible without data corruption because the partitions were setup to use the entire disk geometry as it fits into the file. A successful shrinking operation would require the filesystems and the partition table to be reduced which is not done by the provided simple storage resize method. In addition without the user overwriting the disk size in the XML setup, kiwi will calculate the minimum required size in order to store the data. Thus in almost all cases it will not be possible to store the data in a smaller disk.

exception kiwi.exceptions.KiwiResultError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the image build result pickle information could not be created or loaded.

exception kiwi.exceptions.KiwiRootDirExists(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the specified image root directory already exists and should not be re-used.

exception kiwi.exceptions.KiwiRootImportError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception is raised when something fails during the root import procedure.

exception kiwi.exceptions.KiwiRootInitCreationError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the initialization of a new image root directory has failed.

exception kiwi.exceptions.KiwiRpmDirNotRemoteError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the provided rpm-dir repository is not local

exception kiwi.exceptions.KiwiRuntimeConfigFormatError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the expected format in the yaml KIWI runtime config file does not match

exception kiwi.exceptions.KiwiRuntimeError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if a runtime check has failed.

exception kiwi.exceptions.KiwiSatSolverJobError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if a sat solver job can not be done, e.g because the requested package or collection does not exist in the registered repository metadata

exception kiwi.exceptions.KiwiSatSolverJobProblems(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the sat solver operations returned with solver problems e.g package conflicts

exception kiwi.exceptions.KiwiSatSolverPluginError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the python solv module failed to load. The solv module is provided by SUSE’s rpm package python-solv and provides a python binding to the libsolv C library

exception kiwi.exceptions.KiwiSchemaImportError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the schema file could not be read by lxml.RelaxNG.

exception kiwi.exceptions.KiwiScriptFailed(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if a user script returned with an exit code != 0.

exception kiwi.exceptions.KiwiSetupIntermediateConfigError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the setup of the temporary image system configuration for the duration of the build process has failed.

exception kiwi.exceptions.KiwiSizeError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception is raised when the convertion from a given size in string format to a number.

exception kiwi.exceptions.KiwiSolverRepositorySetupError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the repository type is not supported for the creation of a SAT solvable

exception kiwi.exceptions.KiwiSystemDeletePackagesFailed(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the deletion of a package has failed in the corresponding package manager instance.

exception kiwi.exceptions.KiwiSystemInstallPackagesFailed(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the installation of a package has failed in the corresponding package manager instance.

exception kiwi.exceptions.KiwiSystemUpdateFailed(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the package upgrade has failed in the corresponding package manager instance.

exception kiwi.exceptions.KiwiTargetDirectoryNotFound(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the specified target directory to store the image results was not found.

exception kiwi.exceptions.KiwiTemplateError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the substitution of variables in a configuration file template has failed.

exception kiwi.exceptions.KiwiTypeNotFound(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if no build type was found in the XML description.

exception kiwi.exceptions.KiwiUnknownServiceName(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if an unknown service name was provided on the commandline.

exception kiwi.exceptions.KiwiUriOpenError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the urllib urlopen request has failed

exception kiwi.exceptions.KiwiUriStyleUnknown(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if an unsupported URI style was used in the source definition of a repository.

exception kiwi.exceptions.KiwiUriTypeUnknown(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the protocol type of an URI is unknown in the source definition of a repository.

exception kiwi.exceptions.KiwiValidationError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the XML validation against the schema has failed.

exception kiwi.exceptions.KiwiVhdTagError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the GUID tag is not provided in the expected format.

exception kiwi.exceptions.KiwiVolumeGroupConflict(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the requested LVM volume group already is in use on the build system.

exception kiwi.exceptions.KiwiVolumeManagerSetupError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the preconditions for volume mangement support are not met or an attempt was made to create an instance of a volume manager for an unsupported volume management system.

exception kiwi.exceptions.KiwiVolumeRootIDError(message)[source]

Bases: kiwi.exceptions.KiwiError

Exception raised if the root volume can not be found. This concept currently exists only for the btrfs subvolume system.

kiwi.firmware Module

class kiwi.firmware.FirmWare(xml_state)[source]

Bases: object

Implements firmware specific methods

According to the selected firmware some parameters in a disk image changes. This class provides methods to provide firmware dependant information

  • param object xml_state

    instance of XMLState

bios_mode()[source]

Check if BIOS mode is requested

Returns

True or False

Return type

bool

ec2_mode()[source]

Check if EC2 mode is requested

Returns

True or False

Return type

bool

efi_mode()[source]

Check if EFI mode is requested

Returns

True or False

Return type

bool

get_efi_partition_size()[source]

Size of EFI partition. Returns 0 if no such partition is needed

Returns

mbsize value

Return type

int

get_legacy_bios_partition_size()[source]

Size of legacy bios_grub partition if legacy BIOS mode is required. Returns 0 if no such partition is needed

Returns

mbsize value

Return type

int

get_partition_table_type()[source]

Provides partition table type according to architecture and firmware

Returns

partition table name

Return type

str

get_prep_partition_size()[source]

Size of Prep partition if OFW mode is requested. Returns 0 if no such partition is needed

Returns

mbsize value

Return type

int

legacy_bios_mode()[source]

Check if the legacy boot from BIOS systems should be activated

Returns

True or False

Return type

bool

ofw_mode()[source]

Check if OFW mode is requested

Returns

True or False

Return type

bool

opal_mode()[source]

Check if Opal mode is requested

Returns

True or False

Return type

bool

kiwi.help Module

class kiwi.help.Help[source]

Bases: object

Implements man page help for kiwi commands

Each kiwi command implements their own manual page, which is shown if the positional argument ‘help’ is passed to the command.

show(command=None)[source]

Call man to show the command specific manual page

All kiwi commands store their manual page in the section ‘8’ of the man system. The calling process is replaced by the man process

Parameters

command (string) – man page name

kiwi.kiwi Module

kiwi.kiwi.extras(help_, version, options, doc)[source]

Overwritten method from docopt

Shows our own usage message for -h|–help

Parameters
  • help (bool) – indicate to show help

  • version (string) – version string

  • options (list) –

    list of option tuples

    [option(name='name', value='value')]
    

  • doc (string) – docopt doc string

kiwi.kiwi.main()[source]

kiwi - main application entry point

Initializes a global log object and handles all errors of the application. Every known error is inherited from KiwiError, everything else is passed down until the generic Exception which is handled as unexpected error including the python backtrace

kiwi.kiwi.usage(command_usage)[source]

Instead of the docopt way to show the usage information we provide a kiwi specific usage information. The usage data now always consists out of:

  1. the generic call kiwi [global options] service <command> [<args>]

  2. the command specific usage defined by the docopt string short form by default, long form with -h | –help

  3. the global options

Parameters

command_usage (string) – usage data

kiwi.logger Module

class kiwi.logger.ColorFormatter(*args, **kwargs)[source]

Bases: logging.Formatter

Extended standard logging Formatter

Extended format supporting text with color metadata

Example:

ColorFormatter(message_format, '%H:%M:%S')
format(record)[source]

Creates a logging Formatter with support for color messages

Parameters

record (tuple) – logging message record

Returns

result from format_message

Return type

str

class kiwi.logger.ColorMessage[source]

Bases: object

Implements color messages for Python logging facility

Has to implement the format_message method to serve as message formatter

format_message(level, message)[source]

Message formatter with support for embedded color sequences

The Message is allowed to contain the following color metadata:

  • $RESET, reset to no color mode

  • $BOLD, bold

  • $COLOR, color the following text

  • $LIGHTCOLOR, light color the following text

The color of the message depends on the level and is defined in the ColorMessage constructor

Parameters
  • level (int) – color level number

  • message (string) – text

Returns

color message with escape sequences

Return type

str

class kiwi.logger.DebugFilter(name='')[source]

Bases: logging.Filter

Extended standard debug logging Filter

filter(record)[source]

Only messages with record level DEBUG can pass for messages with another level an extra handler is used

Parameters

record (tuple) – logging message record

Returns

record.name

Return type

str

class kiwi.logger.ErrorFilter(name='')[source]

Bases: logging.Filter

Extended standard error logging Filter

filter(record)[source]

Only messages with record level DEBUG can pass for messages with another level an extra handler is used

Parameters

record (tuple) – logging message record

Returns

record.name

Return type

str

class kiwi.logger.InfoFilter(name='')[source]

Bases: logging.Filter

Extended standard logging Filter

filter(record)[source]

Only messages with record level INFO and WARNING can pass for messages with another level an extra handler is used

Parameters

record (tuple) – logging message record

Returns

record.name

Return type

str

class kiwi.logger.Logger(name)[source]

Bases: logging.Logger

Extended logging facility based on Python logging

Parameters

name (string) – name of the logger

getLogLevel()[source]

Return currently used log level

Returns

log level number

Return type

int

progress(current, total, prefix, bar_length=40)[source]

Custom progress log information. progress information is intentionally only logged to stdout and will bypass any handlers. We don’t want this information to show up in the log file

Parameters
  • current (int) – current item

  • total (int) – total number of items

  • prefix (string) – prefix name

  • bar_length (int) – length of progress bar

setLogLevel(level)[source]

Set custom log level for all console handlers

Parameters

level (int) – log level number

set_color_format()[source]

Set color format for all console handlers

set_logfile(filename)[source]

Set logfile handler

Parameters

filename (string) – logfile file path

class kiwi.logger.LoggerSchedulerFilter(name='')[source]

Bases: logging.Filter

Extended standard logging Filter

filter(record)[source]

Messages from apscheduler scheduler instances are filtered out They conflict with console progress information

Parameters

record (tuple) – logging message record

Returns

record.name

Return type

str

class kiwi.logger.WarningFilter(name='')[source]

Bases: logging.Filter

Extended standard warning logging Filter

filter(record)[source]

Only messages with record level WARNING can pass for messages with another level an extra handler is used

Parameters

record (tuple) – logging message record

Returns

record.name

Return type

str

kiwi.mount_manager Module

class kiwi.mount_manager.MountManager(device, mountpoint=None)[source]

Bases: object

Implements methods for mounting, umounting and mount checking

If a MountManager instance is used to mount a device the caller must care for the time when umount needs to be called. The class does not automatically release the mounted device, which is intentional

  • param string device

    device node name

  • param string mountpoint

    mountpoint directory name

bind_mount()[source]

Bind mount the device to the mountpoint

is_mounted()[source]

Check if mounted

Returns

True or False

Return type

bool

mount(options=None)[source]

Standard mount the device to the mountpoint

Parameters

options (list) – mount options

umount()[source]

Umount by the mountpoint directory

If the resource is busy the call will return False

Returns

True or False

Return type

bool

umount_lazy()[source]

Umount by the mountpoint directory in lazy mode

Release the mount in any case, however the time when the mounted resource is released by the kernel depends on when the resource enters the non busy state

kiwi.path Module

class kiwi.path.Path[source]

Bases: object

Directory path helpers

static access(path, mode, **kwargs)[source]

Check whether path can be accessed with the given mode.

Parameters
  • path (str) – The path that should be checked for access.

  • mode (int) – Which access mode should be checked. This value must be a bit-wise or of one or more of the following constants: os.F_OK (note that this one is zero), os.X_OK, os.R_OK and os.W_OK

  • kwargs – further keyword arguments are forwarded to os.access()

Returns

Boolean value whether this access mode is allowed

Return type

bool

Raises
static create(path)[source]

Create path and all sub directories to target

Parameters

path (string) – path name

static remove(path)[source]

Delete empty path, causes an error if target is not empty

Parameters

path (string) – path name

static remove_hierarchy(path)[source]

Recursively remove an empty path and its sub directories ignore non empty or protected paths and leave them untouched

Parameters

path (string) – path name

static sort_by_hierarchy(path_list)[source]

Sort given list of path names by their hierachy in the tree

Example:

result = Path.sort_by_hierarchy(['/var/lib', '/var'])
Parameters

path_list (list) – list of path names

Returns

hierachy sorted path_list

Return type

list

static which(filename, alternative_lookup_paths=None, custom_env=None, access_mode=None)[source]

Lookup file name in PATH

Parameters
  • filename (string) – file base name

  • alternative_lookup_paths (list) – list of additional lookup paths

  • custom_env (list) – a custom os.environ

  • access_mode (int) – one of the os access modes or a combination of them (os.R_OK, os.W_OK and os.X_OK). If the provided access mode does not match the file is considered not existing

Returns

absolute path to file or None

Return type

str

static wipe(path)[source]

Delete path and all contents

Parameters

path (string) – path name

kiwi.privileges Module

class kiwi.privileges.Privileges[source]

Bases: object

Implements check for root privileges

static check_for_root_permissions()[source]

Check if we are effectively root on the system. If not an exception is thrown

Returns

True or raise an Exception

Return type

bool

kiwi.runtime_checker Module

class kiwi.runtime_checker.RuntimeChecker(xml_state)[source]

Bases: object

Implements build consistency checks at runtime

The schema of an image description covers structure and syntax of the provided data. The RuntimeChecker provides methods to perform further semantic checks which allows to recognize potential build or boot problems early.

  • param object xml_state

    Instance of XMLState

check_boot_description_exists()[source]

If a kiwi initrd is used, a lookup to the specified boot description is done and fails early if it does not exist

check_consistent_kernel_in_boot_and_system_image()[source]

If a kiwi initrd is used, the kernel used to build the kiwi initrd and the kernel used in the system image must be the same in order to avoid an inconsistent boot setup

check_container_tool_chain_installed()[source]

When creating container images the specific tools are used in order to import and export OCI or Docker compatible images. This check searches for those tools to be installed in the build system and fails if it can’t find them

check_dracut_module_for_disk_oem_in_package_list()[source]

OEM images if configured to use dracut as initrd system requires the KIWI provided dracut-kiwi-oem-repart module to be installed at the time dracut is called. Thus this runtime check examines if the required package is part of the package list in the image description.

check_dracut_module_for_disk_overlay_in_package_list()[source]

Disk images configured to use a root filesystem overlay requires the KIWI provided kiwi-overlay dracut module to be installed at the time dracut is called. Thus this runtime check examines if the required package is part of the package list in the image description.

check_dracut_module_for_live_iso_in_package_list()[source]

Live ISO images uses a dracut initrd to boot and requires the KIWI provided kiwi-live dracut module to be installed at the time dracut is called. Thus this runtime check examines if the required package is part of the package list in the image description.

check_dracut_module_for_oem_install_in_package_list()[source]

OEM images if configured to use dracut as initrd system and configured with one of the installiso, installstick or installpxe attributes requires the KIWI provided dracut-kiwi-oem-dump module to be installed at the time dracut is called. Thus this runtime check examines if the required package is part of the package list in the image description.

check_efi_mode_for_disk_overlay_correctly_setup()[source]

Disk images configured to use a root filesystem overlay only supports the standard EFI mode and not secure boot. That’s because the shim setup performs changes to the root filesystem which can not be applied during the bootloader setup at build time because at that point the root filesystem is a read-only squashfs source.

check_image_include_repos_publicly_resolvable()[source]

Verify that all repos marked with the imageinclude attribute can be resolved into a http based web URL

check_mediacheck_installed()[source]

If the image description enables the mediacheck attribute the required tools to run this check must be installed on the image build host

check_minimal_required_preferences()[source]

Kiwi requires some of the elements of the preferences element to be present at least in one of the preferences section. This runtime check validates <version> and <packagemanager> are provided.

check_repositories_configured()[source]

Verify that that there are repositories configured

check_target_directory_not_in_shared_cache(target_dir)[source]

The target directory must be outside of the kiwi shared cache directory in order to avoid busy mounts because kiwi bind mounts the cache directory into the image root tree to access host caching information

Parameters

target_dir (string) – path name

check_volume_label_used_with_lvm()[source]

The optional volume label in a systemdisk setup is only effective if the LVM, logical volume manager system is used. In any other case where the filesystem itself offers volume management capabilities there are no extra filesystem labels which can be applied per volume

check_volume_setup_defines_multiple_fullsize_volumes()[source]

The volume size specification ‘all’ makes this volume to take the rest space available on the system. It’s only allowed to specify one all size volume

check_volume_setup_has_no_root_definition()[source]

The root volume in a systemdisk setup is handled in a special way. It is not allowed to setup a custom name or mountpoint for the root volume. Therefore the size of the root volume can be setup via the @root volume name. This check looks up the volume setup and searches if there is a configuration for the ‘/’ mountpoint which would cause the image build to fail

check_xen_uniquely_setup_as_server_or_guest()[source]

If the image is classified to be used as Xen image, it can be either a Xen Server(dom0) or a Xen guest. The image configuration is checked if the information uniquely identifies the image as such

kiwi.runtime_config Module

class kiwi.runtime_config.RuntimeConfig[source]

Bases: object

Implements reading of runtime configuration file:

  1. ~/.config/kiwi/config.yml

  2. /etc/kiwi.yml

The KIWI runtime configuration file is a yaml formatted file containing information to control the behavior of the tools used by KIWI.

get_bundle_compression(default=True)[source]

Return boolean value to express if the image bundle should contain XZ compressed image results or not.

bundle:
  • compress: true|false

If compression of image build results is activated the size of the bundle is smaller and the download speed increases. However the image must be uncompressed before use

If no compression is explicitly configured, the provided default value applies

Parameters

default (bool) – Default value

Returns

True or False

Return type

bool

get_container_compression()[source]

Return compression algorithm to use for compression of container images

container:
  • compress: xz|none

if no or invalid configuration data is provided, the default compression algorithm from the Defaults class is returned

Returns

A name

Return type

str

get_disabled_runtime_checks()[source]

Returns disabled runtime checks. Checks can be disabled with:

runtime_checks:
  • disable: check_container_tool_chain_installed

if the provided string does not match any RuntimeChecker method it is just ignored.

get_iso_tool_category()[source]

Return tool category which should be used to build iso images

iso:
  • tool_category: cdrtools|xorriso

if no or invalid configuration exists the default tool category from the Defaults class is returned

Returns

A name

Return type

str

get_max_size_constraint()[source]

Returns the maximum allowed size of the built image. The value is returned in bytes and it is specified in build_constraints element with the max_size attribute. The value can be specified in bytes or it can be specified with m=MB or g=GB.

build_constraints:
  • max_size: 700m

if no configuration exists None is returned

Returns

byte value or None

Return type

int

get_obs_download_server_url()[source]

Return URL of buildservice download server in:

obs:
  • download_url: …

if no configuration exists the downloadserver from the Defaults class is returned

Returns

URL type data

Return type

str

get_oci_archive_tool()[source]

Return OCI archive tool which should be used on creation of container archives for OCI compliant images, e.g docker

oci:
  • archive_tool: umoci

if no configuration exists the default tool from the Defaults class is returned

Returns

A name

Return type

str

get_xz_options()[source]

Return list of XZ compression options in:

xz:
  • options: …

if no configuration exists None is returned

Returns

Contains list of options

['--option=value']

Return type

list

is_obs_public()[source]

Check if the buildservice configuration is public or private in:

obs:
  • public: true|false

if no configuration exists we assume to be public

Returns

True or False

Return type

bool

kiwi.version Module

Global version information used in kiwi and the package

kiwi.xml_description Module

class kiwi.xml_description.XMLDescription(description=None, derived_from=None, xml_content=None)[source]

Bases: object

Implements data management for the XML description

  • XSLT Style Sheet processing to apply on this version of kiwi

  • Schema Validation based on RelaxNG schema

  • Loading XML data into internal data structures

Attributes

Parameters
  • description (string) – path to XML description file

  • derived_from (string) – path to base XML description file

  • xml_content (string) – XML description data as content string

get_extension_xml_data(namespace_name)[source]

Return the xml etree parse result for the specified extension namespace

Parameters

namespace_name (string) – name of the extension namespace

Returns

result of etree.parse

Return type

object

load()[source]

Read XML description, pass it along to the XSLT processor, validate it against the schema and finally pass it to the autogenerated(generateDS) parser.

Returns

instance of XML toplevel domain (image)

Return type

object

kiwi.xml_state Module

class kiwi.xml_state.XMLState(xml_data, profiles=None, build_type=None)[source]

Bases: object

Implements methods to get stateful information from the XML data

Parameters
  • xml_data (object) – instance of XMLDescription

  • profiles (list) – list of used profiles

  • build_type (object) – build <type> section reference

add_container_config_label(label_name, value)[source]

Adds a new label in the containerconfig section, if a label with the same name is already defined in containerconfig it gets overwritten by this method.

Parameters
  • label_name (str) – the string representing the label name

  • value (str) – the value of the label

add_repository(repo_source, repo_type, repo_alias, repo_prio, repo_imageinclude=False, repo_package_gpgcheck=None)[source]

Add a new repository section at the end of the list

Parameters
  • repo_source (string) – repository URI

  • repo_type (string) – type name defined by schema

  • repo_alias (string) – alias name

  • repo_prio (string) – priority number, package manager specific

  • repo_imageinclude (boolean) – setup repository inside of the image

  • repo_package_gpgcheck (boolean) – enable/disable package gpg checks

copy_bootdelete_packages(target_state)[source]

Copy packages marked as bootdelete to the packages type=delete section in the target xml state

Parameters

target_state (object) – XMLState instance

copy_bootincluded_archives(target_state)[source]

Copy archives marked as bootinclude to the packages type=bootstrap section in the target xml state

Parameters

target_state (object) – XMLState instance

copy_bootincluded_packages(target_state)[source]

Copy packages marked as bootinclude to the packages type=image (or type=bootstrap if no type=image was found) section in the target xml state. The package will also be removed from the packages type=delete section in the target xml state if present there

Parameters

target_state (object) – XMLState instance

copy_build_type_attributes(attribute_names, target_state)[source]

Copy specified attributes from this build type section to the target xml state build type section

Parameters
  • attribute_names (list) – type section attributes

  • target_state (object) – XMLState instance

copy_displayname(target_state)[source]

Copy image displayname from this xml state to the target xml state

Parameters

target_state (object) – XMLState instance

copy_drivers_sections(target_state)[source]

Copy drivers sections from this xml state to the target xml state

Parameters

target_state (object) – XMLState instance

copy_machine_section(target_state)[source]

Copy machine sections from this xml state to the target xml state

Parameters

target_state (object) – XMLState instance

copy_name(target_state)[source]

Copy image name from this xml state to the target xml state

Parameters

target_state (object) – XMLState instance

copy_oemconfig_section(target_state)[source]

Copy oemconfig sections from this xml state to the target xml state

Parameters

target_state (object) – XMLState instance

copy_preferences_subsections(section_names, target_state)[source]

Copy subsections of the preferences sections, matching given section names, from this xml state to the target xml state

Parameters
  • section_names (list) – preferences subsection names

  • target_state (object) – XMLState instance

copy_repository_sections(target_state, wipe=False)[source]

Copy repository sections from this xml state to the target xml state

Parameters
  • target_state (object) – XMLState instance

  • wipe (bool) – delete all repos in target prior to copy

copy_strip_sections(target_state)[source]

Copy strip sections from this xml state to the target xml state

Parameters

target_state (object) – XMLState instance

copy_systemdisk_section(target_state)[source]

Copy systemdisk sections from this xml state to the target xml state

Parameters

target_state (object) – XMLState instance

delete_repository_sections()[source]

Delete all repository sections matching configured profiles

delete_repository_sections_used_for_build()[source]

Delete all repository sections used to build the image matching configured profiles

get_bootstrap_archives()[source]

List of archive names from the type=”bootstrap” packages section(s)

Returns

archive names

Return type

list

get_bootstrap_collection_type()[source]

Collection type for packages sections matching type=”bootstrap”

Returns

collection type name

Return type

str

get_bootstrap_collections()[source]

List of collection names from the packages sections matching type=”bootstrap”

Returns

collection names

Return type

list

get_bootstrap_packages()[source]

List of package names from the type=”bootstrap” packages section(s)

The list gets the selected package manager appended if there is a request to install packages inside of the image via a chroot operation

Returns

package names

Return type

list

get_bootstrap_packages_sections()[source]

List of packages sections matching type=”bootstrap”

Returns

list of <packages> section reference(s)

Return type

list

get_bootstrap_products()[source]

List of product names from the packages sections matching type=”bootstrap”

Returns

product names

Return type

list

get_build_type_containerconfig_section()[source]

First containerconfig section from the build type section

Returns

<containerconfig> section reference

Return type

xml_parse::containerconfig

get_build_type_format_options()[source]

Disk format options returned as a dictionary

Returns

format options

Return type

dict

get_build_type_machine_section()[source]

First machine section from the build type section

Returns

<machine> section reference

Return type

xml_parse::machine

get_build_type_name()[source]

Default build type name

Returns

Content of image attribute from build type

Return type

str

get_build_type_oemconfig_section()[source]

First oemconfig section from the build type section

Returns

<oemconfig> section reference

Return type

xml_parse::oemconfig

get_build_type_size(include_unpartitioned=False)[source]

Size information from the build type section. If no unit is set the value is treated as mbytes

Parameters

include_unpartitioned (bool) – sets if the unpartitioned area should be included in the computed size or not

Returns

mbytes

Return type

int

get_build_type_spare_part_size()[source]

Size information for the spare_part size from the build type. If no unit is set the value is treated as mbytes

Returns

mbytes

Return type

int

get_build_type_system_disk_section()[source]

First system disk section from the build type section

Returns

<systemdisk> section reference

Return type

xml_parse::systemdisk

get_build_type_unpartitioned_bytes()[source]

Size of the unpartitioned area for image in megabytes

Returns

mbytes

Return type

int

get_build_type_vagrant_config_section()[source]

First vagrantconfig section from the build type section

Returns

<vagrantconfig> section reference

Return type

xml_parse::vagrantconfig

get_build_type_vmconfig_entries()[source]

List of vmconfig-entry section values from the first machine section in the build type section

Returns

<vmconfig_entry> section reference(s)

Return type

list

get_build_type_vmdisk_section()[source]

First vmdisk section from the first machine section in the build type section

Returns

<vmdisk> section reference

Return type

xml_parse::vmdisk

get_build_type_vmdvd_section()[source]

First vmdvd section from the first machine section in the build type section

Returns

<vmdvd> section reference

Return type

xml_parse::vmdvd

get_build_type_vmnic_entries()[source]

vmnic section(s) from the first machine section in the build type section

Returns

list of <vmnic> section reference(s)

Return type

list

get_collection_type(section_type='image')[source]

Collection type from packages sections matching given section type.

If no collection type is specified the default collection type is set to: onlyRequired

Parameters

section_type (string) – type name from packages section

Returns

collection type name

Return type

str

get_collections(section_type='image')[source]

List of collection names from the packages sections matching type=section_type and type=build_type

Returns

collection names

Return type

list

get_container_config()[source]

Dictionary of containerconfig information

Takes attributes and subsection data from the selected <containerconfig> section and stores it in a dictionary

get_derived_from_image_uri()[source]

Uri object of derived image if configured

Specific image types can be based on a master image. This method returns the location of this image when configured in the XML description

Returns

Instance of Uri

Return type

object

get_description_section()[source]

The description section

Returns

description_type tuple providing the elements author contact and specification

Return type

tuple

get_disk_start_sector()[source]

First disk sector number to be used by the first disk partition.

Returns

number

Return type

int

get_distribution_name_from_boot_attribute()[source]

Extract the distribution name from the boot attribute of the build type section.

If no boot attribute is configured or the contents does not match the kiwi defined naming schema for boot image descriptions, an exception is thrown

Returns

lowercase distribution name

Return type

str

get_drivers_list()[source]

List of driver names from all drivers sections matching configured profiles

Returns

driver names

Return type

list

get_fs_mount_option_list()[source]

List of root filesystem mount options

The list contains one element with the information from the fsmountoptions attribute. The value there is passed along to the -o mount option

Returns

max one element list with mount option string

Return type

list

get_image_packages_sections()[source]

List of packages sections matching type=”image”

Returns

list of <packages> section reference(s)

Return type

list

get_image_version()[source]

Image version from preferences section.

Multiple occurences of version in preferences sections are not forbidden, however only the first version found defines the final image version

Returns

Content of <version> section

Return type

str

get_initrd_system()[source]

Name of initrd system to use

Depending on the image type a specific initrd system is either pre selected or free of choice according to the XML type setup

Returns

dracut, kiwi or None

Return type

str

get_locale()[source]

Gets list of locale names if configured. Takes the first locale setup from the existing preferences sections into account.

Returns

List of names or None

Return type

list|None

get_oemconfig_oem_multipath_scan()[source]

State value to activate multipath maps. Returns a boolean value if specified or None

Returns

Content of <oem-multipath-scan> section value

Return type

bool

get_package_manager()[source]

Get configured package manager from selected preferences section

Returns

Content of the <packagemanager> section

Return type

str

get_package_sections(packages_sections)[source]

List of package sections from the given packages sections. Each list element contains a tuple with the <package> section reference and the <packages> section this package belongs to

If a package entry specfies an architecture, it is only taken if the host architecture matches the configured architecture

Parameters

packages_sections (list) – <packages>

Returns

Contains list of package_type tuples

[package_type(packages_section=object, package_section=object)]

Return type

list

get_packages_sections(section_types)[source]

List of packages sections matching given section type(s)

Parameters

section_types (list) – type name(s) from packages sections

Returns

list of <packages> section reference(s)

Return type

list

get_preferences_sections()[source]

All preferences sections for the selected profiles

Returns

list of <preferences> section reference(s)

Return type

list

get_products(section_type='image')[source]

List of product names from the packages sections matching type=section_type and type=build_type

Parameters

section_type (string) – type name from packages section

Returns

product names

Return type

list

get_repository_sections()[source]

List of all repository sections matching configured profiles

Returns

<repository> section reference(s)

Return type

list

get_repository_sections_used_for_build()[source]

List of all repositorys sections used to build the image and matching configured profiles.

Returns

<repository> section reference(s)

Return type

list

get_repository_sections_used_in_image()[source]

List of all repositorys sections to be configured in the resulting image matching configured profiles.

Returns

<repository> section reference(s)

Return type

list

get_rpm_check_signatures()[source]

Gets the rpm-check-signatures configuration flag. Returns False if not present.

Returns

True or False

Return type

bool

get_rpm_excludedocs()[source]

Gets the rpm-excludedocs configuration flag. Returns False if not present.

Returns

True or False

Return type

bool

get_rpm_locale()[source]

Gets list of locale names to filter out by rpm if rpm-locale-filtering is switched on the the list always contains: [POSIX, C, C.UTF-8] and is extended by the optionaly configured locale

Returns

List of names or None

Return type

list|None

get_rpm_locale_filtering()[source]

Gets the rpm-locale-filtering configuration flag. Returns False if not present.

Returns

True or False

Return type

bool

get_strip_files_to_delete()[source]

Items to delete from strip section

Returns

item names

Return type

list

get_strip_libraries_to_keep()[source]

Libraries to keep from strip section

Returns

librarie names

Return type

list

get_strip_list(section_type)[source]

List of strip names matching the given section type and profiles

Parameters

section_type (string) – type name from packages section

Returns

strip names

Return type

list

get_strip_tools_to_keep()[source]

Tools to keep from strip section

Returns

tool names

Return type

list

get_system_archives()[source]

List of archive names from the packages sections matching type=”image” and type=build_type

Returns

archive names

Return type

list

get_system_collection_type()[source]

Collection type for packages sections matching type=”image”

Returns

collection type name

Return type

str

get_system_collections()[source]

List of collection names from the packages sections matching type=”image”

Returns

collection names

Return type

list

get_system_ignore_packages()[source]

List of ignore package names from the packages sections matching type=”image” and type=build_type

Returns

package names

Return type

list

get_system_packages()[source]

List of package names from the packages sections matching type=”image” and type=build_type

Returns

package names

Return type

list

get_system_products()[source]

List of product names from the packages sections matching type=”image”

Returns

product names

Return type

list

get_to_become_deleted_packages(force=True)[source]

List of package names from the type=”delete” or type=”uninstall” packages section(s)

Parameters

force (bool) – return “delete” type if True, “uninstall” type otherwise

Returns

package names

Return type

list

get_user_groups(user_name)[source]

List of group names matching specified user

Each entry in the list is the name of a group that the specified user belongs to. The first item in the list is the login or primary group. The list will be empty if no groups are specified in the description file.

Returns

groups data for the given user

Return type

list

get_users()[source]

List of configured users.

Each entry in the list is a single xml_parse::user instance.

Returns

list of <user> section reference(s)

Return type

list

get_users_sections()[source]

All users sections for the selected profiles

Returns

list of <users> section reference(s)

Return type

list

get_vagrant_config_virtualbox_guest_additions()[source]

Attribute virtualbox_guest_additions_present from the first vagrantconfig section.

Returns

<vagrantconfig virtualbox_guest_additions_present=> value

Return type

bool

get_volume_group_name()[source]

Volume group name from selected <systemdisk> section

Returns

volume group name

Return type

str

get_volume_management()[source]

Provides information which volume management system is used

Returns

name of volume manager

Return type

str

get_volumes()[source]

List of configured systemdisk volumes.

Each entry in the list is a tuple with the following information

  • name: name of the volume

  • size: size of the volume

  • realpath: system path to lookup volume data. If no mountpoint is set the volume name is used as data path.

  • mountpoint: volume mount point and volume data path

  • fullsize: takes all space True|False

  • attributes: list of volume attributes handled via chattr

Returns

Contains list of volume_type tuples

[
    volume_type(
        name=volume_name,
        size=volume_size,
        realpath=path,
        mountpoint=path,
        fullsize=True,
        label=volume_label,
        attributes=['no-copy-on-write']
    )
]

Return type

list

is_xen_guest()[source]

Check if build type setup specifies a Xen Guest (domX) The check is based on the architecture, the firmware and xen_loader configuration values:

  • We only support Xen setup on the x86_64 architecture

  • Firmware pointing to ec2 means the image is targeted to run in Amazon EC2 which is a Xen guest

  • Machine setup with a xen_loader attribute also indicates a Xen guest target

Returns

True or False

Return type

bool

is_xen_server()[source]

Check if build type domain setup specifies a Xen Server (dom0)

Returns

True or False

Return type

bool

package_matches_host_architecture(package)[source]

Tests if the given package section is applicable for the current host architecture. If no architecture is specified within the section it is considered as a match returning True.

Note: The XML section pointer must provide an arch attribute

Parameters

section – XML section object

Returns

True or False

Return type

bool

profile_matches_host_architecture(profile)[source]

Tests if the given profile section is applicable for the current host architecture. If no architecture is specified within the section it is considered as a match returning True.

Note: The XML section pointer must provide an arch attribute

Parameters

section – XML section object

Returns

True or False

Return type

bool

set_container_config_tag(tag)[source]

Set new tag name in containerconfig section

In order to set a new tag value an existing containerconfig and tag setup is required

Parameters

tag (string) – tag name

set_derived_from_image_uri(uri)[source]

Set derived_from attribute to a new value

In order to set a new value the derived_from attribute must be already present in the image configuration

Parameters

uri (string) – URI

set_repository(repo_source, repo_type, repo_alias, repo_prio, repo_imageinclude=False, repo_package_gpgcheck=None)[source]

Overwrite repository data of the first repository

Parameters
  • repo_source (string) – repository URI

  • repo_type (string) – type name defined by schema

  • repo_alias (string) – alias name

  • repo_prio (string) – priority number, package manager specific

  • repo_imageinclude (boolean) – setup repository inside of the image

  • repo_package_gpgcheck (boolean) – enable/disable package gpg checks

Module Contents