libcobblersignatures.models package

Submodules

libcobblersignatures.models.osbreed module

class libcobblersignatures.models.osbreed.OsBreed(name: str)

Bases: object

On operating system breed like SUSE or Redhat. The specification of the attributes and what values are valid are described in the JSON specification.

decode(data: dict)

Decodes the received data. Decoding of each single version is done by the corresponding decode method in Osversion.

Parameters:

data – The data to decode.

encode() dict

Encodes the current OsBreed and nested Osversions.

Returns:

The dictionary with all its versions. The name of the OsBreed is not included as this is normally the name of the returned key.

property name

This property represents the name of the operating system breed.

Setter:

Invalid values will be discarded.

Deleter:

Always raises a TypeError since this is not allowed.

Getter:

The last successfully validated name of the operating system breed.

osversion_add(name: str, version: Osversion)

Add an Osversion to this OsBreed.

Parameters:
  • name – The name of the version to add.

  • version – The Osversion to add to the OsBreed.

Raises:

ValueError – If the Name is not a str and/or the Version is not an Osversion.

osversion_remove(key: str)

Remove an Osversion with its key.

Parameters:

key – The key of the dictionary to remove.

property osversions: OrderedDict

An ordered dictionary which contains all versions of the operating system breed.

Setter:

Raises a TypeError in case the value is not an OrderedDict.

Getter:

The ordered dictionary.

Deleter:

Will reset the number of versions to an empty list.

libcobblersignatures.models.osversion module

Module for the datastructure of an operating system version. An operating system version needs to be grouped under an operating system breed.

class libcobblersignatures.models.osversion.Osversion

Bases: object

A version of an operating system breed like openSUSE Leap 15.2. The specification of the attributes and what values are valid are described in the JSON specification.

property boot_files: set

Extra files, beyond the kernel and initrd, that must be copied out of the source tree and templated for the distro.

Getter:

The last successfully validated value of this field.

Setter:

Will set this if the validation succeeds, otherwise will raise an exception (TypeError).

Deleter:

Resets this to an empty list.

Type:

set

property boot_loaders: dict

The boot loaders Cobbler considers valid for this OS version, keyed by architecture.

Getter:

The last successfully validated value of this field.

Setter:

If validation is successful the value will be set, otherwise raises an exception (TypeError).

Deleter:

Resets this property to an empty dict.

Type:

dict

decode(data: dict)

Decodes the received data. This means parsing each attribute from the JSON into the property of an object.

Parameters:

data – The data to decode.

property default_autoinstall: str

The filename for the default autoinstall template in Cobbler.

Getter:

The last successfully validated value of this field.

Setter:

Will set this if the validation succeeds, otherwise will raise an exception (TypeError).

Deleter:

Resets this to an empty str.

Type:

str

encode() dict

Encodes a single Osversion. This means that the properties of an object is transferred into a JSON.

Returns:

The dictionary with the data.

property initrd_file: str

The regular expression to match to find the initrd.

Getter:

The last successfully validated value of this field.

Setter:

Will set this if the validation succeeds, otherwise will raise an exception (TypeError).

Deleter:

Resets this to an empty str.

Type:

str

property isolinux_ok: bool

Whether directories named isolinux should still be scanned for a kernel/initrd pair instead of being skipped.

Getter:

The last successfully validated value of this field.

Setter:

Will set this if the validation succeeds, otherwise will raise an exception (TypeError).

Deleter:

Resets this to False.

Type:

bool

property kernel_arch: str

The regular expression which tells Cobbler where to look for the architecture of the operating system. In some cases this may also be a path to the file where Cobbler should look for the architecture.

Getter:

The value of the last successfully validated kernel_arch.

Setter:

May raise a TypeError in case the value was not of type str.

Deleter:

Resets the value instead of deleting the attribute.

Type:

str

property kernel_arch_regex: str

The regex applied within the file located via kernel_arch when it doesn’t point to the architecture directly.

Getter:

The last successfully validated value of this field.

Setter:

Will set this if the validation succeeds, otherwise will raise an exception (TypeError).

Deleter:

Resets this to an empty str.

Type:

str

property kernel_file: str

The regular expression to match to find the kernel.

Getter:

The last successfully validated value of this field.

Setter:

Will set this if the validation succeeds, otherwise will raise an exception (TypeError).

Deleter:

Resets this to an empty str.

Type:

str

property kernel_options: str

Default kernel options to apply to the imported ISO.

Getter:

The last successfully validated value of this field.

Setter:

Will set this if the validation succeeds, otherwise will raise an exception (TypeError).

Deleter:

Resets this to an empty str.

Type:

str

property kernel_options_post: str

Default kernel post options to apply to the imported ISO.

Getter:

The last successfully validated value of this field.

Setter:

Will set this if the validation succeeds, otherwise will raise an exception (TypeError).

Deleter:

Resets this to an empty str.

Type:

str

property signatures: set

One or more paths, relative to the root of the ISO, whose existence identifies this OS version.

Setter:

May raise a TypeError in case the value was not of type list.

Getter:

Returns the last correctly validated str of the property.

Deleter:

Resets this to an empty list.

Type:

set

property supported_arches: set

The architectures Cobbler considers valid when detecting the architecture of an imported distro.

Getter:

The last successfully validated value of this field.

Setter:

Will set this if the validation succeeds, otherwise will raise an exception (TypeError).

Deleter:

Resets this to an empty list.

Type:

set

property supported_repo_breeds: set

The repository breeds Cobbler may auto-create when it finds a matching repo in the install tree.

Getter:

The last successfully validated value of this field.

Setter:

Will set this if the validation succeeds, otherwise will raise an exception (TypeError).

Deleter:

Resets this to an empty list.

Type:

set

property template_files: str

Extra files merged into the imported distro’s template_files, used to render templated boot files (e.g. ESXi’s boot.cfg).

Getter:

The last successfully validated value of this field.

Setter:

Will set this if the validation succeeds, otherwise will raise an exception (TypeError).

Deleter:

Resets this to an empty str.

Type:

str

property version_file: str

The regular expression which points to the file with the os-version info.

Setter:

May raise a TypeError in case the value was not of type str.

Getter:

Returns the last correctly validated str of the property.

Deleter:

Resets this to an empty string.

Type:

str

property version_file_regex: str

The regular expression matched against the contents of the file located via version_file to confirm this version.

Getter:

The str with the regex.

Setter:

Validates the regex and raises in case an error was detected (TypeError).

Deleter:

Resets the attribute to an empty str instead of deleting it.

Type:

str

Module contents

This module contains the data structures of the library. You may use them without using the library, however they may not work as expected when using them on its own.