8.1.3. cobbler.items package

8.1.3.1. Submodules

8.1.3.2. cobbler.items.distro module

Cobbler module that contains the code for a Cobbler distro object.

Changelog:

Schema: From -> To

V3.4.0 (unreleased):
  • Added:
    • find_distro_path()

    • link_distro()

  • Changed:
    • Constructor: kwargs can now be used to seed the item during creation.

    • children: The property was moved to the base class.

    • from_dict(): The method was moved to the base class.

V3.3.4 (unreleased):
  • No changes

V3.3.3:
  • Changed:
    • redhat_management_key: Inherits from the settings again

V3.3.2:
  • No changes

V3.3.1:
  • No changes

V3.3.0:
  • This release switched from pure attributes to properties (getters/setters).

  • Added:
    • from_dict()

  • Moved to base class (Item):
    • ctime: float

    • depth: int

    • mtime: float

    • uid: str

    • kernel_options: dict

    • kernel_options_post: dict

    • autoinstall_meta: dict

    • boot_files: list/dict

    • template_files: list/dict

    • comment: str

    • name: str

    • owners: list[str]

  • Changed:
    • tree_build_time: str -> float

    • arch: str -> Union[list, str]

    • fetchable_files: list/dict? -> dict

    • boot_loader -> boot_loaders (rename)

  • Removed:
    • get_fields()

    • get_parent

    • set_kernel() - Please use the property kernel

    • set_remote_boot_kernel() - Please use the property remote_boot_kernel

    • set_tree_build_time() - Please use the property tree_build_time

    • set_breed() - Please use the property breed

    • set_os_version() - Please use the property os_version

    • set_initrd() - Please use the property initrd

    • set_remote_boot_initrd() - Please use the property remote_boot_initrd

    • set_source_repos() - Please use the property source_repos

    • set_arch() - Please use the property arch

    • get_arch() - Please use the property arch

    • set_supported_boot_loaders() - Please use the property supported_boot_loaders. It is readonly.

    • set_boot_loader() - Please use the property boot_loader

    • set_redhat_management_key() - Please use the property redhat_management_key

    • get_redhat_management_key() - Please use the property redhat_management_key

V3.2.2:
  • No changes

V3.2.1:
  • Added:
    • kickstart: Resolves as a proxy to autoinstall

V3.2.0:
  • No changes

V3.1.2:
  • Added:
    • remote_boot_kernel: str

    • remote_grub_kernel: str

    • remote_boot_initrd: str

    • remote_grub_initrd: str

V3.1.1:
  • No changes

V3.1.0:
  • Added:
    • get_arch()

V3.0.1:
  • File was moved from cobbler/item_distro.py to cobbler/items/distro.py.

V3.0.0:
  • Added:
    • boot_loader: Union[str, inherit]

  • Changed:
    • rename: ks_meta -> autoinstall_meta

    • redhat_management_key: Union[str, inherit] -> str

  • Removed:
    • redhat_management_server: Union[str, inherit]

V2.8.5:
  • Inital tracking of changes for the changelog.

  • Added:
    • name: str

    • ctime: float

    • mtime: float

    • uid: str

    • owners: Union[list, SETTINGS:default_ownership]

    • kernel: str

    • initrd: str

    • kernel_options: dict

    • kernel_options_post: dict

    • ks_meta: dict

    • arch: str

    • breed: str

    • os_version: str

    • source_repos: list

    • depth: int

    • comment: str

    • tree_build_time: str

    • mgmt_classes: list

    • boot_files: list/dict?

    • fetchable_files: list/dict?

    • template_files: list/dict?

    • redhat_management_key: Union[str, inherit]

    • redhat_management_server: Union[str, inherit]

class cobbler.items.distro.Distro(api: CobblerAPI, *args: Any, **kwargs: Any)[source]

Bases: Item

A Cobbler distribution object

COLLECTION_TYPE = 'distro'
TYPE_NAME = 'distro'
property arch

The field is mainly relevant to PXE provisioning.

Using an alternative distro type allows for dhcpd.conf templating to “do the right thing” with those systems – this also relates to bootloader configuration files which have different syntax for different distro types (because of the bootloaders).

This field is named “arch” because mainly on Linux, we only care about the architecture, though if (in the future) new provisioning types are added, an arch value might be something like “bsd_x86”.

Returns

Return the current architecture.

property boot_loaders: List[str]

All boot loaders for which Cobbler generates entries for.

Note

This property can be set to <<inherit>>.

Getter

The bootloaders.

Setter

Validates this against the list of well-known bootloaders and raises a TypeError or ValueError in case the validation goes south.

property breed: str

The repository system breed. This decides some defaults for most actions with a repo in Cobbler.

Getter

The breed detected.

Setter

May raise a ValueError or TypeError in case the given value is wrong.

check_if_valid()[source]

Check if a distro object is valid. If invalid an exception is raised.

find_distro_path()[source]

This returns the absolute path to the distro under the distro_mirror directory. If that directory doesn’t contain the kernel, the directory of the kernel in the distro is returned.

Returns

The path to the distribution files.

property initrd: str

Specifies an initrd image. Path search works as in set_kernel. File must be named appropriately.

Getter

The current path to the initrd.

Setter

May raise a TypeError or ValueError in case the validation is not successful.

property kernel: str

Specifies a kernel. The kernel parameter is a full path, a filename in the configured kernel directory or a directory path that would contain a selectable kernel. Kernel naming conventions are checked, see docs in the utils module for find_kernel.

Getter

The last successfully validated kernel path.

Setter

May raise a ValueError or TypeError in case of validation errors.

Link a Cobbler distro from its source into the web directory to make it reachable from the outside.

make_clone()[source]

Clone a distro object.

Returns

The cloned object. Not persisted on the disk or in a database.

property os_version: str

The operating system version which the image contains.

Getter

The sanitized operating system version.

Setter

Accepts a str which will be validated against the distro_signatures.json.

property parent

Distros don’t have parent objects.

property redhat_management_key: str

Get the redhat management key. This is probably only needed if you have spacewalk, uyuni or SUSE Manager running.

Note

This property can be set to <<inherit>>.

Returns

The key as a string.

property remote_boot_initrd: str

URL to a remote initrd. If the bootloader supports this feature, it directly tries to retrieve the initrd and boot it. (grub supports tftp and http protocol and server must be an IP).

Getter

Returns the current remote URL to boot from.

Setter

Raises a TypeError or ValueError in case the provided value was not correct.

property remote_boot_kernel: str

URL to a remote kernel. If the bootloader supports this feature, it directly tries to retrieve the kernel and boot it. (grub supports tftp and http protocol and server must be an IP).

Getter

Returns the current remote URL to boot from.

Setter

Raises a TypeError or ValueError in case the provided value was not correct.

property remote_grub_initrd: str

This is tied to the remote_boot_initrd property. It contains the URL of that field in a format which grub can use directly.

Getter

The computed URL from remote_boot_initrd.

property remote_grub_kernel: str

This is tied to the remote_boot_kernel property. It contains the URL of that field in a format which grub can use directly.

Getter

The computed URL from remote_boot_kernel.

property source_repos: List[Any]

A list of http:// URLs on the Cobbler server that point to yum configuration files that can be used to install core packages. Use by cobbler import only.

Getter

The source repos used.

Setter

The new list of source repos to use.

property supported_boot_loaders: List[str]

Some distributions, particularly on powerpc, can only be netbooted using specific bootloaders.

Returns

The bootloaders which are available for being set.

property tree_build_time: float

Represents the import time of the distro. If not imported, this field is not meaningful.

Getter

Setter

8.1.3.3. cobbler.items.image module

Cobbler module that contains the code for a Cobbler image object.

Changelog:

V3.4.0 (unreleased):
  • Added:
    • display_name

  • Changed:
    • Constructor: kwargs can now be used to seed the item during creation.

    • autoinstall: Restored inheritance of the property.

    • children: The proqperty was moved to the base class.

    • from_dict(): The method was moved to the base class.

    • virt_disk_driver: Restored inheritance of the property.

    • virt_ram: Restored inheritance of the property.

    • virt_type: Restored inheritance of the property.

    • virt_bridge: Restored inheritance of the property.

V3.3.4 (unreleased):
  • No changes

V3.3.3:
  • Added:
    • children

  • Changes:
    • virt_file_size: Inherits from the settings again

    • boot_loaders: Inherits from the settings again

V3.3.2:
  • No changes

V3.3.1:
  • No changes

V3.3.0:
  • This release switched from pure attributes to properties (getters/setters).

  • Added:
    • boot_loaders: list

    • menu: str

    • supported_boot_loaders: list

    • from_dict()

  • Moved to parent class (Item):
    • ctime: float

    • mtime: float

    • depth: int

    • parent: str

    • uid: str

    • comment: str

    • name: str

  • Removed:
    • get_fields()

    • get_parent()

    • set_arch() - Please use the arch property.

    • set_autoinstall() - Please use the autoinstall property.

    • set_file() - Please use the file property.

    • set_os_version() - Please use the os_version property.

    • set_breed() - Please use the breed property.

    • set_image_type() - Please use the image_type property.

    • set_virt_cpus() - Please use the virt_cpus property.

    • set_network_count() - Please use the network_count property.

    • set_virt_auto_boot() - Please use the virt_auto_boot property.

    • set_virt_file_size() - Please use the virt_file_size property.

    • set_virt_disk_driver() - Please use the virt_disk_driver property.

    • set_virt_ram() - Please use the virt_ram property.

    • set_virt_type() - Please use the virt_type property.

    • set_virt_bridge() - Please use the virt_bridge property.

    • set_virt_path() - Please use the virt_path property.

    • get_valid_image_types()

  • Changes:
    • arch: str -> enums.Archs

    • autoinstall: str -> enums.VALUE_INHERITED

    • image_type: str -> enums.ImageTypes

    • virt_auto_boot: Union[bool, SETTINGS:virt_auto_boot] -> bool

    • virt_bridge: Union[str, SETTINGS:default_virt_bridge] -> str

    • virt_disk_driver: Union[str, SETTINGS:default_virt_disk_driver] -> enums.VirtDiskDrivers

    • virt_file_size: Union[float, SETTINGS:default_virt_file_size] -> float

    • virt_ram: Union[int, SETTINGS:default_virt_ram] -> int

    • virt_type: Union[str, SETTINGS:default_virt_type] -> enums.VirtType

V3.2.2:
  • No changes

V3.2.1:
  • Added:
    • kickstart: Resolves as a proxy to autoinstall

V3.2.0:
  • No changes

V3.1.2:
  • No changes

V3.1.1:
  • No changes

V3.1.0:
  • No changes

V3.0.1:
  • No changes

V3.0.0:
  • Added:
    • set_autoinstall()

  • Changes:
    • Rename: kickstart -> autoinstall

  • Removed:
    • set_kickstart() - Please use set_autoinstall()

V2.8.5:
  • Inital tracking of changes for the changelog.

  • Added:
    • ctime: float

    • depth: int

    • mtime: float

    • parent: str

    • uid: str

    • arch: str

    • kickstart: str

    • breed: str

    • comment: str

    • file: str

    • image_type: str

    • name: str

    • network_count: int

    • os_version: str

    • owners: Union[list, SETTINGS:default_ownership]

    • virt_auto_boot: Union[bool, SETTINGS:virt_auto_boot]

    • virt_bridge: Union[str, SETTINGS:default_virt_bridge]

    • virt_cpus: int

    • virt_disk_driver: Union[str, SETTINGS:default_virt_disk_driver]

    • virt_file_size: Union[float, SETTINGS:default_virt_file_size]

    • virt_path: str

    • virt_ram: Union[int, SETTINGS:default_virt_ram]

    • virt_type: Union[str, SETTINGS:default_virt_type]

class cobbler.items.image.Image(api: CobblerAPI, *args: Any, **kwargs: Any)[source]

Bases: Item

A Cobbler Image. Tracks a virtual or physical image, as opposed to a answer file (autoinst) led installation.

COLLECTION_TYPE = 'image'
TYPE_NAME = 'image'
property arch: Archs

Represents the architecture the image has. If deployed to a physical host this should be enforced, a virtual image may be deployed on a host with any architecture.

Getter

The current architecture. Default is X86_64.

Setter

Should be of the enum type or str. May raise an exception in case the architecture is not known to Cobbler.

property autoinstall: str

Property for the automatic installation file path, this must be a local file.

It may not make sense for images to have automatic installation templates. It really doesn’t. However if the image type is ‘iso’ koan can create a virtual floppy and shove an answer file on it, to script an installation. This may not be a automatic installation template per se, it might be a Windows answer file (SIF) etc.

This property can inherit from a parent. Which is actually the default value.

Getter

The path relative to the template directory.

Setter

The location of the template relative to the template base directory.

property boot_loaders: List[str]

Represents the boot loaders which are able to boot this image.

Getter

The bootloaders. May be an emtpy list.

Setter

A list with the supported boot loaders for this image.

property breed: str

The operating system breed.

Getter

Returns the current breed.

Setter

When setting this it is validated against the distro_signatures.json file.

property display_name: str

Returns the display name.

Getter

Returns the display name for the boot menu.

Setter

Sets the display name for the boot menu.

property file: str

Stores the image location. This should be accessible on all nodes that need to access it.

Format: can be one of the following: * username:password@hostname:/path/to/the/filename.ext * username@hostname:/path/to/the/filename.ext * hostname:/path/to/the/filename.ext * /path/to/the/filename.ext

Getter

The path to the image location or an emtpy string.

Setter

May raise a TypeError or SyntaxError in case the validation of the location fails.

property image_type: ImageTypes

Indicates what type of image this is. direct = something like “memdisk”, physical only iso = a bootable ISO that pxe’s or can be used for virt installs, virtual only virt-clone = a cloned virtual disk (FIXME: not yet supported), virtual only memdisk = hdd image (physical only)

Getter

The enum type value of the image type.

Setter

Accepts str like and enum type values and raises a TypeError or ValueError in the case of a problem.

make_clone()[source]

Clone this image object. Please manually adjust all value yourself to make the cloned object unique.

Returns

The cloned instance of this object.

property menu: str

Property to represent the menu which this image should be put into.

Getter

The name of the menu or an emtpy str.

Setter

Should only be the name of the menu not the object. May raise CX in case the menu does not exist.

property network_count: int

Represents the number of virtual NICs this image has.

Deprecated since version 3.3.0: This is nowhere used in the project and will be removed in a future release.

Getter

The number of networks.

Setter

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

property os_version: str

The operating system version which the image contains.

Getter

The sanitized operating system version.

Setter

Accepts a str which will be validated against the distro_signatures.json.

property supported_boot_loaders: List[str]

Read only property which represents the subset of settable bootloaders.

Getter

The bootloaders which are available for being set.

property virt_auto_boot: bool

Whether the VM should be booted when booting the host or not.

Getter

True means autoboot is enabled, otherwise VM is not booted automatically.

Setter

The new state for the property.

property virt_bridge: str

The name of the virtual bridge used for networking.

Warning

The new validation for the setter is not working. Thus the inheritance from the settings is broken.

Getter

The name of the bridge.

Setter

The new name of the bridge. If set to an empty str, it will be taken from the settings.

property virt_cpus: int

The amount of vCPU cores used in case the image is being deployed on top of a VM host.

Getter

The cores used.

Setter

The new number of cores.

property virt_disk_driver: VirtDiskDrivers

The type of disk driver used for storing the image.

Getter

The enum type representation of the disk driver.

Setter

May be a str with the name of the disk driver or from the enum type directly.

property virt_file_size: float

The size of the image and thus the usable size for the guest.

Warning

There is a regression which makes the usage of multiple disks not possible right now. This will be fixed in a future release.

Getter

The size of the image(s) in GB.

Setter

The float with the new size in GB.

property virt_path: str

Represents the location where the image for the VM is stored.

Getter

The path.

Setter

Is being validated for being a reasonable path. If yes is set, otherwise ignored.

property virt_ram: int

The amount of RAM given to the guest in MB.

Getter

The amount of RAM currently assigned to the image.

Setter

The new amount of ram. Must be an integer.

property virt_type: VirtType

The type of image used.

Getter

The value of the virtual machine.

Setter

May be of the enum type or a str which is then converted to the enum type.

8.1.3.4. cobbler.items.item module

Cobbler module that contains the code for a generic Cobbler item.

Changelog:

V3.4.0 (unreleased):
  • (Re-)Added Cache implementation with the following new methods and properties:
    • cache

    • inmemery

    • clean_cache()

  • Overhauled the parent/child system:
    • children is now inside item.py.

    • tree_walk() was added.

    • logical_parent was added.

    • get_parent() was added which returns the internal reference that is used to return the object of the parent property.

  • Removed:
    • mgmt_classes

    • mgmt_parameters

V3.3.4 (unreleased):
  • No changes

V3.3.3:
  • Added:
    • grab_tree

V3.3.2:
  • No changes

V3.3.1:
  • No changes

V3.3.0:
  • This release switched from pure attributes to properties (getters/setters).

  • Added:
    • depth: int

    • comment: str

    • owners: Union[list, str]

    • mgmt_classes: Union[list, str]

    • mgmt_classes: Union[dict, str]

    • conceptual_parent: Union[distro, profile]

  • Removed:
    • collection_mgr: collection_mgr

    • Remove unreliable caching:
      • get_from_cache()

      • set_cache()

      • remove_from_cache()

  • Changed:
    • Constructor: Takes an instance of CobblerAPI instead of CollectionManager.

    • children: dict -> list

    • ctime: int -> float

    • mtime: int -> float

    • uid: str

    • kernel_options: dict -> Union[dict, str]

    • kernel_options_post: dict -> Union[dict, str]

    • autoinstall_meta: dict -> Union[dict, str]

    • fetchable_files: dict -> Union[dict, str]

    • boot_files: dict -> Union[dict, str]

V3.2.2:
  • No changes

V3.2.1:
  • No changes

V3.2.0:
  • No changes

V3.1.2:
  • No changes

V3.1.1:
  • No changes

V3.1.0:
  • No changes

V3.0.1:
  • No changes

V3.0.0:
  • Added:
    • collection_mgr: collection_mgr

    • kernel_options: dict

    • kernel_options_post: dict

    • autoinstall_meta: dict

    • fetchable_files: dict

    • boot_files: dict

    • template_files: dict

    • name: str

    • last_cached_mtime: int

  • Changed:
    • Rename: cached_datastruct -> cached_dict

  • Removed:
    • config

V2.8.5:
  • Added:
    • config: ?

    • settings: settings

    • is_subobject: bool

    • parent: Union[distro, profile]

    • children: dict

    • log_func: collection_mgr.api.log

    • ctime: int

    • mtime: int

    • uid: str

    • last_cached_mtime: int

    • cached_datastruct: str

class cobbler.items.item.Item(api: CobblerAPI, is_subobject: bool = False, **kwargs: Any)[source]

Bases: object

An Item is a serializable thing that can appear in a Collection

COLLECTION_TYPE = 'generic'
LOGICAL_INHERITANCE: Dict[str, Tuple[List[Tuple[str, str]], List[Tuple[str, str]]]] = {'distro': ([], [('profile', 'distro')]), 'image': ([], [('system', 'image')]), 'profile': ([('distro', 'distro')], [('system', 'profile')]), 'system': ([('image', 'image'), ('profile', 'profile')], [])}
TYPE_DEPENDENCIES: Dict[str, List[Tuple[str, str]]] = {'distro': [('profile', 'distro')], 'image': [('system', 'image')], 'menu': [('menu', 'parent'), ('image', 'menu'), ('profile', 'menu')], 'profile': [('profile', 'parent'), ('system', 'profile')], 'repo': [('profile', 'repos')], 'system': []}
TYPE_NAME = 'generic'
property autoinstall_meta: Dict[Any, Any]

A comma delimited list of key value pairs, like ‘a=b,c=d,e=f’ or a dict. The meta tags are used as input to the templating system to preprocess automatic installation template files.

Note

This property can be set to <<inherit>>.

Getter

The metadata or an empty dict.

Setter

Accepts anything which can be split by input_string_or_dict().

property boot_files: Dict[Any, Any]

Files copied into tftpboot beyond the kernel/initrd

Getter

The dictionary with name-path key-value pairs.

Setter

A dict. If not a dict must be a str which is split by input_string_or_dict(). Raises TypeError otherwise.

property cache: ItemCache

Gettinging the ItemCache oject.

Note

This is a read only property.

Getter

This is the ItemCache oject.

check_if_valid() None[source]

Raise exceptions if the object state is inconsistent.

Raises

CX – In case the name of the item is not set.

property children: List[ITEM_UNION]

The list of logical children of any depth. :getter: An empty list in case of items which don’t have logical children. :setter: Replace the list of children completely with the new provided one.

clean_cache(name: Optional[str] = None)[source]

Clearing the Item cache.

Parameters
  • obj – The object whose modification invalidates the dict cache. Can be Item, Settings or SIGNATURE_CACHE.

  • name – The name of Item attribute or None.

property comment: str

For every object you are able to set a unique comment which will be persisted on the object.

Getter

The comment or an emtpy string.

Setter

The new comment for the item.

property ctime: float

Property which represents the creation time of the object.

Getter

The float which can be passed to Python time stdlib.

Setter

Should only be used by the Cobbler Item Factory.

property depth: int

This represents the logical depth of an object in the category of the same items. Important for the order of loading items from the disk and other related features where the alphabetical order is incorrect for sorting.

Getter

The logical depth of the object.

Setter

The new int for the logical object-depth.

property descendants: List[ITEM_UNION]

Get objects that depend on this object, i.e. those that would be affected by a cascading delete, etc.

Note

This is a read only property.

Getter

This is a list of all descendants. May be empty if none exist.

deserialize() None[source]

Deserializes the object itself and, if necessary, recursively all the objects it depends on.

dump_vars(formatted_output: bool = True, remove_dicts: bool = False) Union[Dict[str, Any], str][source]

Dump all variables.

Parameters
  • formatted_output – Whether to format the output or not.

  • remove_dicts – If True the dictionaries will be put into str form.

Returns

The raw or formatted data.

property fetchable_files: Dict[Any, Any]

A comma seperated list of virt_name=path_to_template that should be fetchable via tftp or a webserver

Note

This property can be set to <<inherit>>.

Getter

The dictionary with name-path key-value pairs.

Setter

A dict. If not a dict must be a str which is split by input_string_or_dict(). Raises TypeError otherwise.

find_match(kwargs: Dict[str, Any], no_errors: bool = False) bool[source]

Find from a given dict if the item matches the kv-pairs.

Parameters
  • kwargs – The dict to match for in this item.

  • no_errors – How strict this matching is.

Returns

True if matches or False if the item does not match.

find_match_single_key(data: Dict[str, Any], key: str, value: Any, no_errors: bool = False) bool[source]

Look if the data matches or not. This is an alternative for find_match().

Parameters
  • data – The data to search through.

  • key – The key to look for int the item.

  • value – The value for the key.

  • no_errors – How strict this matching is.

Returns

Whether the data matches or not.

from_dict(dictionary: Dict[Any, Any]) None[source]

Modify this object to take on values in dictionary.

Parameters

dictionary – This should contain all values which should be updated.

Raises
  • AttributeError – In case during the process of setting a value for an attribute an error occurred.

  • KeyError – In case there were keys which could not be set in the item dictionary.

get_conceptual_parent() Optional[ITEM_UNION][source]

The parent may just be a superclass for something like a subprofile. Get the first parent of a different type.

Returns

The first item which is conceptually not from the same type.

property get_parent: str

This method returns the name of the parent for the object. In case there is not parent this return empty string.

grab_tree() List[Union[Item, Settings]][source]

Climb the tree and get every node.

Returns

The list of items with all parents from that object upwards the tree. Contains at least the item itself and the settings of Cobbler.

property inmemory: bool

If set to false, only the Item name is in memory. The rest of the Item’s properties can be retrieved either on demand or as a result of the load_items background task.

Getter

The inmemory for the item.

Setter

The new inmemory value for the object. Should only be used by the Cobbler serializers.

property is_subobject: bool

Weather the object is a subobject of another object or not.

Getter

True in case the object is a subobject, False otherwise.

Setter

Sets the value. If this is not a bool, this will raise a TypeError.

property kernel_options: Dict[Any, Any]

Kernel options are a space delimited list, like ‘a=b c=d e=f g h i=j’ or a dict.

Note

This property can be set to <<inherit>>.

Getter

The parsed kernel options.

Setter

The new kernel options as a space delimited list. May raise ValueError in case of parsing problems.

property kernel_options_post: Dict[str, Any]

Post kernel options are a space delimited list, like ‘a=b c=d e=f g h i=j’ or a dict.

Note

This property can be set to <<inherit>>.

Getter

The dictionary with the parsed values.

Setter

Accepts str in above mentioned format or directly a dict.

property logical_parent: Any

This property contains the name of the logical parent of an object. In case there is not parent this return None.

Getter

Returns the parent object or None if it can’t be resolved via the Cobbler API.

Setter

The name of the new logical parent.

abstract make_clone() ITEM[source]

Must be defined in any subclass

property mtime: float

Represents the last modification time of the object via the API. This is not updated automagically.

Getter

The float which can be fed into a Python time object.

Setter

The new time something was edited via the API.

property name: str

Property which represents the objects name.

Getter

The name of the object.

Setter

Updating this has broad implications. Please try to use the rename() functionality from the corresponding collection.

property owners: List[Any]

This is a feature which is related to the ownership module of Cobbler which gives only specific people access to specific records. Otherwise this is just a cosmetic feature to allow assigning records to specific users.

Warning

This is never validated against a list of existing users. Thus you can lock yourself out of a record.

Note

This property can be set to <<inherit>>.

Getter

Return the list of users which are currently assigned to the record.

Setter

The list of people which should be new owners. May lock you out if you are using the ownership authorization module.

property parent: Optional[Union[System, Profile, Distro, Menu]]

This property contains the name of the parent of an object. In case there is not parent this return None.

Getter

Returns the parent object or None if it can’t be resolved via the Cobbler API.

Setter

The name of the new logical parent.

serialize() Dict[str, Any][source]

This method is a proxy for to_dict() and contains additional logic for serialization to a persistent location.

Returns

The dictionary with the information for serialization.

sort_key(sort_fields: List[Any])[source]

Convert the item to a dict and sort the data after specific given fields.

Parameters

sort_fields – The fields to sort the data after.

Returns

The sorted data.

property template_files: Dict[Any, Any]

File mappings for built-in configuration management

Getter

The dictionary with name-path key-value pairs.

Setter

A dict. If not a dict must be a str which is split by input_string_or_dict(). Raises TypeError otherwise.

to_dict(resolved: bool = False) Dict[Any, Any][source]

This converts everything in this object to a dictionary.

Parameters

resolved – If this is True, Cobbler will resolve the values to its final form, rather than give you the objects raw value.

Returns

A dictionary with all values present in this object.

tree_walk() List[ITEM_UNION][source]

Get all children related by parent/child relationship. :return: The list of children objects.

property uid: str

The uid is the internal unique representation of a Cobbler object. It should never be used twice, even after an object was deleted.

Getter

The uid for the item. Should be unique across a running Cobbler instance.

Setter

The new uid for the object. Should only be used by the Cobbler Item Factory.

8.1.3.5. cobbler.items.menu module

Cobbler module that contains the code for a Cobbler menu object.

Changelog:

V3.4.0 (unreleased):
  • Changes:
    • Constructor: kwargs can now be used to seed the item during creation.

    • children: The property was moved to the base class.

    • parent: The property was moved to the base class.

    • from_dict(): The method was moved to the base class.

V3.3.4 (unreleased):
  • No changes

V3.3.3:
  • Changed:
    • check_if_valid(): Now present in base class.

V3.3.2:
  • No changes

V3.3.1:
  • No changes

V3.3.0:
  • Inital version of the item type.

  • Added:
    • display_name: str

class cobbler.items.menu.Menu(api: CobblerAPI, *args: Any, **kwargs: Any)[source]

Bases: Item

A Cobbler menu object.

COLLECTION_TYPE = 'menu'
TYPE_NAME = 'menu'
property display_name: str

Returns the display name.

Getter

Returns the display name for the boot menu.

Setter

Sets the display name for the boot menu.

make_clone() Menu[source]

Clone this file object. Please manually adjust all value yourself to make the cloned object unique.

Returns

The cloned instance of this object.

8.1.3.6. cobbler.items.profile module

Cobbler module that contains the code for a Cobbler profile object.

Changelog:

V3.4.0 (unreleased):
  • Changes:
    • Constructor: kwargs can now be used to seed the item during creation.

    • children: The property was moved to the base class.

    • parent: The property was moved to the base class.

    • from_dict(): The method was moved to the base class.

V3.3.4 (unreleased):
  • No changes

V3.3.3:
  • Changed:
    • next_server_v4: str -> enums.VALUE_INHERITED

    • next_server_v6: str -> enums.VALUE_INHERITED

    • virt_bridge: str -> enums.VALUE_INHERITED

    • virt_file_size: int -> enums.VALUE_INHERITED

    • virt_ram: int -> enums.VALUE_INHERITED

V3.3.2:
  • No changes

V3.3.1:
  • No changes

V3.3.0:
  • This release switched from pure attributes to properties (getters/setters).

  • Added:
    • boot_loaders: Union[list, str]

    • enable_ipxe: bool

    • next_server_v4: str

    • next_server_v6: str

    • menu: str

    • from_dict()

  • Removed:
    • enable_gpxe: Union[bool, SETTINGS:enable_gpxe]

    • next_server: Union[str, inherit]

    • get_fields()

    • get_parent(): Please use the property parent instead

    • set_parent(): Please use the property parent instead

    • set_distro(): Please use the property distro instead

    • set_name_servers(): Please use the property name_servers instead

    • set_name_servers_search(): Please use the property name_servers_search instead

    • set_proxy(): Please use the property proxy instead

    • set_enable_gpxe(): Please use the property enable_gpxe instead

    • set_enable_menu(): Please use the property enable_menu instead

    • set_dhcp_tag(): Please use the property dhcp_tag instead

    • set_server(): Please use the property server instead

    • set_next_server(): Please use the property next_server instead

    • set_filename(): Please use the property filename instead

    • set_autoinstall(): Please use the property autoinstall instead

    • set_virt_auto_boot(): Please use the property virt_auto_boot instead

    • set_virt_cpus(): Please use the property virt_cpus instead

    • set_virt_file_size(): Please use the property virt_file_size instead

    • set_virt_disk_driver(): Please use the property virt_disk_driver instead

    • set_virt_ram(): Please use the property virt_ram instead

    • set_virt_type(): Please use the property virt_type instead

    • set_virt_bridge(): Please use the property virt_bridge instead

    • set_virt_path(): Please use the property virt_path instead

    • set_repos(): Please use the property repos instead

    • set_redhat_management_key(): Please use the property redhat_management_key instead

    • get_redhat_management_key(): Please use the property redhat_management_key instead

    • get_arch(): Please use the property arch instead

  • Changed:
    • autoinstall: Union[str, SETTINGS:default_kickstart] -> enums.VALUE_INHERITED

    • enable_menu: Union[bool, SETTINGS:enable_menu] -> bool

    • name_servers: Union[list, SETTINGS:default_name_servers] -> list

    • name_servers_search: Union[list, SETTINGS:default_name_servers_search] -> list

    • filename: Union[str, inherit] -> str

    • proxy: Union[str, SETTINGS:proxy_url_int] -> enums.VALUE_INHERITED

    • redhat_management_key: Union[str, inherit] -> enums.VALUE_INHERITED

    • server: Union[str, inherit] -> enums.VALUE_INHERITED

    • virt_auto_boot: Union[bool, SETTINGS:virt_auto_boot] -> bool

    • virt_bridge: Union[str, SETTINGS:default_virt_bridge] -> str

    • virt_cpus: int -> Union[int, str]

    • virt_disk_driver: Union[str, SETTINGS:default_virt_disk_driver] -> enums.VirtDiskDrivers

    • virt_file_size: Union[int, SETTINGS:default_virt_file_size] -> int

    • virt_ram: Union[int, SETTINGS:default_virt_ram] -> int

    • virt_type: Union[str, SETTINGS:default_virt_type] -> enums.VirtType

    • boot_files: list/dict? -> enums.VALUE_INHERITED

    • fetchable_files: dict -> enums.VALUE_INHERITED

    • autoinstall_meta: dict -> enums.VALUE_INHERITED

    • kernel_options: dict -> enums.VALUE_INHERITED

    • kernel_options_post: dict -> enums.VALUE_INHERITED

    • mgmt_classes: list -> enums.VALUE_INHERITED

    • mgmt_parameters: Union[str, inherit] -> enums.VALUE_INHERITED

    (mgmt_classes parameter has a duplicate)

V3.2.2:
  • No changes

V3.2.1:
  • Added:
    • kickstart: Resolves as a proxy to autoinstall

V3.2.0:
  • No changes

V3.1.2:
  • Added:
    • filename: Union[str, inherit]

V3.1.1:
  • No changes

V3.1.0:
  • Added:
    • get_arch()

V3.0.1:
  • File was moved from cobbler/item_profile.py to cobbler/items/profile.py.

V3.0.0:
  • Added:
    • next_server: Union[str, inherit]

  • Changed:
    • Renamed: kickstart -> autoinstall

    • Renamed: ks_meta -> autoinstall_meta

    • autoinstall: Union[str, SETTINGS:default_kickstart] -> Union[str, SETTINGS:default_autoinstall]

    • set_kickstart(): Renamed to set_autoinstall()

  • Removed:
    • redhat_management_server: Union[str, inherit]

    • template_remote_kickstarts: Union[bool, SETTINGS:template_remote_kickstarts]

    • set_redhat_management_server()

    • set_template_remote_kickstarts()

V2.8.5:
  • Inital tracking of changes for the changelog.

  • Added
    • ctime: int

    • depth: int

    • mtime: int

    • uid: str

    • kickstart: Union[str, SETTINGS:default_kickstart]

    • ks_meta: dict

    • boot_files: list/dict?

    • comment: str

    • dhcp_tag: str

    • distro: str

    • enable_gpxe: Union[bool, SETTINGS:enable_gpxe]

    • enable_menu: Union[bool, SETTINGS:enable_menu]

    • fetchable_files: dict

    • kernel_options: dict

    • kernel_options_post: dict

    • mgmt_classes: list

    • mgmt_parameters: Union[str, inherit]

    • name: str

    • name_servers: Union[list, SETTINGS:default_name_servers]

    • name_servers_search: Union[list, SETTINGS:default_name_servers_search]

    • owners: Union[list, SETTINGS:default_ownership]

    • parent: str

    • proxy: Union[str, SETTINGS:proxy_url_int]

    • redhat_management_key: Union[str, inherit]

    • redhat_management_server: Union[str, inherit]

    • template_remote_kickstarts: Union[bool, SETTINGS:template_remote_kickstarts]

    • repos: list

    • server: Union[str, inherit]

    • template_files: dict

    • virt_auto_boot: Union[bool, SETTINGS:virt_auto_boot]

    • virt_bridge: Union[str, SETTINGS:default_virt_bridge]

    • virt_cpus: int

    • virt_disk_driver: Union[str, SETTINGS:default_virt_disk_driver]

    • virt_file_size: Union[int, SETTINGS:default_virt_file_size]

    • virt_path: str

    • virt_ram: Union[int, SETTINGS:default_virt_ram]

    • virt_type: Union[str, SETTINGS:default_virt_type]

class cobbler.items.profile.Profile(api: CobblerAPI, *args: Any, **kwargs: Any)[source]

Bases: Item

A Cobbler profile object.

COLLECTION_TYPE = 'profile'
TYPE_NAME = 'profile'
property arch: Optional[Archs]

This represents the architecture of a profile. It is read only.

Getter

None or the parent architecture.

property autoinstall: str

Represents the automatic OS installation template file path, this must be a local file.

Getter

Either the inherited name or the one specific to this profile.

Setter

The name of the new autoinstall template is validated. The path should come in the format of a str.

property boot_loaders: List[str]

This represents all boot loaders for which Cobbler will try to generate bootloader configuration for.

Note

This property can be set to <<inherit>>.

Getter

The bootloaders.

Setter

The new bootloaders. Will be validates against a list of well known ones.

check_if_valid()[source]

Check if the profile is valid. This checks for an existing name and a distro as a conceptual parent.

Raises

CX – In case the distro or name is not present.

property dhcp_tag: str

Represents the VLAN tag the DHCP Server is in/answering to.

Getter

The VLAN tag or nothing if a system with the profile should not be in a VLAN.

Setter

The new VLAN tag.

property display_name: str

Returns the display name.

Getter

Returns the display name for the boot menu.

Setter

Sets the display name for the boot menu.

property distro: Optional[Distro]

The parent distro of a profile. This is not representing the Distro but the id of it.

This is a required property, if saved to the disk, with the exception if this is a subprofile.

Returns

The distro object or None.

property enable_ipxe: bool

Sets whether or not the profile will use iPXE for booting.

Getter

If set to inherit then this returns the parent value, otherwise it returns the real value.

Setter

May throw a TypeError in case the new value cannot be cast to bool.

property enable_menu: bool

Sets whether or not the profile will be listed in the default PXE boot menu. This is pretty forgiving for YAML’s sake.

Getter

The value resolved from the defaults or the value specific to the profile.

Setter

May raise a TypeError in case the boolean could not be converted.

property filename: str

The filename which is fetched by the client from TFTP.

If the filename is set to <<inherit>> and there is no parent profile then it will be set to an empty string.

Getter

Either the default/inherited one, or the one specific to this profile.

Setter

The new filename which is fetched on boot. May raise a TypeError when the wrong type was given.

find_match_single_key(data: Dict[str, Any], key: str, value: Any, no_errors: bool = False) bool[source]

Look if the data matches or not. This is an alternative for find_match().

Parameters
  • data – The data to search through.

  • key – The key to look for int the item.

  • value – The value for the key.

  • no_errors – How strict this matching is.

Returns

Whether the data matches or not.

make_clone()[source]

Clone this file object. Please manually adjust all value yourself to make the cloned object unique.

Returns

The cloned instance of this object.

property menu: str

Property to represent the menu which this image should be put into.

Getter

The name of the menu or an emtpy str.

Setter

Should only be the name of the menu not the object. May raise CX in case the menu does not exist.

property name_servers: List[Any]

Represents the list of nameservers to set for the profile.

Getter

The nameservers.

Setter

Comma delimited str or list with the nameservers.

Represents the list of DNS search paths.

Getter

The list of DNS search paths.

Setter

Comma delimited str or list with the nameservers search paths.

property next_server_v4: str

Represents the next server for IPv4.

Getter

The IP for the next server.

Setter

May raise a TypeError if the new value is not of type str.

property next_server_v6: str

Represents the next server for IPv6.

Getter

The IP for the next server.

Setter

May raise a TypeError if the new value is not of type str.

property proxy: str

Override the default external proxy which is used for accessing the internet.

Getter

Returns the default one or the specific one for this repository.

Setter

May raise a TypeError in case the wrong value is given.

property redhat_management_key: str

Getter of the redhat management key of the profile or it’s parent.

Note

This property can be set to <<inherit>>.

Getter

Returns the redhat_management_key of the profile.

Setter

May raise a TypeError in case of a validation error.

property repos: Union[str, List[str]]

The repositories to add once the system is provisioned.

Getter

The names of the repositories the profile has assigned.

Setter

The new names of the repositories for the profile. Validated against existing repositories.

property server: str

Represents the hostname the Cobbler server is reachable by a client.

Note

This property can be set to <<inherit>>.

Getter

The hostname of the Cobbler server.

Setter

May raise a TypeError in case the new value is not a str.

property virt_auto_boot: bool

Whether the VM should be booted when booting the host or not.

Note

This property can be set to <<inherit>>.

Getter

True means autoboot is enabled, otherwise VM is not booted automatically.

Setter

The new state for the property.

property virt_bridge: str

Represents the name of the virtual bridge to use.

Note

This property can be set to <<inherit>>.

Getter

Either the default name for the bridge or the specific one for this profile.

Setter

The new name. Does not overwrite the default one.

property virt_cpus: int

The amount of vCPU cores used in case the image is being deployed on top of a VM host.

Getter

The cores used.

Setter

The new number of cores.

property virt_disk_driver: VirtDiskDrivers

The type of disk driver used for storing the image.

Note

This property can be set to <<inherit>>.

Getter

The enum type representation of the disk driver.

Setter

May be a str with the name of the disk driver or from the enum type directly.

property virt_file_size: float

The size of the image and thus the usable size for the guest.

Warning

There is a regression which makes the usage of multiple disks not possible right now. This will be fixed in a future release.

Note

This property can be set to <<inherit>>.

Getter

The size of the image(s) in GB.

Setter

The float with the new size in GB.

property virt_path: str

The path to the place where the image will be stored.

Getter

The path to the image.

Setter

The new path for the image.

property virt_ram: int

The amount of RAM given to the guest in MB.

Note

This property can be set to <<inherit>>.

Getter

The amount of RAM currently assigned to the image.

Setter

The new amount of ram. Must be an integer.

property virt_type: VirtType

The type of image used.

Note

This property can be set to <<inherit>>.

Getter

The value of the virtual machine.

Setter

May be of the enum type or a str which is then converted to the enum type.

8.1.3.7. cobbler.items.repo module

Cobbler module that contains the code for a Cobbler repo object.

Changelog:

V3.4.0 (unreleased):
  • Changed:
    • Constructor: kwargs can now be used to seed the item during creation.

    • children: The property was moved to the base class.

    • from_dict(): The method was moved to the base class.

V3.3.4 (unreleased):
  • No changes

V3.3.3:
  • No changes

V3.3.2:
  • No changes

V3.3.1:
  • No changes

V3.3.0:
  • This release switched from pure attributes to properties (getters/setters).

  • Added:
    • os_version: str

    • from_dict()

  • Moved to base class (Item):
    • ctime: float

    • depth: float

    • mtime: float

    • parent: str

    • uid: str

    • comment: str

    • name: str

    • owners: Union[list, SETTINGS:default_ownership]

  • Changes:
    • breed: str -> enums.RepoBreeds

    • arch: str -> enums.RepoArchs

    • rsyncopts: dict/str? -> dict

    • mirror_type: str -> enums.MirrorType

    • apt_components: list/str? -> list

    • apt_dists: list/str? -> list

    • createrepo_flags: Union[dict, inherit] -> enums.VALUE_INHERITED

    • proxy: Union[str, inherit] -> enums.VALUE_INHERITED

V3.2.2:
  • No changes

V3.2.1:
  • Added:
    • mirror_type: str

    • set_mirror_type()

V3.2.0:
  • Added:
    • rsyncopts: dict/str

    • set_rsyncopts()

V3.1.2:
  • No changes

V3.1.1:
  • No changes

V3.1.0:
  • Changed:
    • arch: New valid value s390x as an architecture.

V3.0.1:
  • File was moved from cobbler/item_repo.py to cobbler/items/repo.py.

V3.0.0:
  • Changes:
    • proxy: Union[str, inherit, SETTINGS:proxy_url_ext] -> Union[str, inherit]

V2.8.5:
  • Inital tracking of changes for the changelog.

  • Added:
    • ctime: float

    • depth: float

    • mtime: float

    • parent: str

    • uid: str

    • apt_components: list/str?

    • apt_dists: list/str?

    • arch: str

    • breed: str

    • comment: str

    • createrepo_flags: Union[dict, inherit]

    • environment: dict

    • keep_updated: bool

    • mirror: str

    • mirror_locally: bool

    • name: str

    • owners: Union[list, SETTINGS:default_ownership]

    • priority: int

    • proxy: Union[str, inherit, SETTINGS:proxy_url_ext]

    • rpm_list: list

    • yumopts: dict

class cobbler.items.repo.Repo(api: CobblerAPI, *args: Any, **kwargs: Any)[source]

Bases: Item

A Cobbler repo object.

COLLECTION_TYPE = 'repo'
TYPE_NAME = 'repo'
property apt_components: List[str]

Specify the section of Debian to mirror. Defaults to “main,contrib,non-free,main/debian-installer”.

Getter

If empty the default is used.

Setter

May be a comma delimited str or a real list.

property apt_dists: List[str]

This decides which installer images are downloaded. For more information please see: https://www.debian.org/CD/mirroring/index.html or the manpage of debmirror.

Getter

Per default no images are mirrored.

Setter

Either a comma delimited str or a real list.

property arch: RepoArchs

Override the arch used for reposync

Getter

The repo arch enum object.

Setter

May throw a ValueError or TypeError in case the conversion of the value is unsuccessful.

property breed: RepoBreeds

The repository system breed. This decides some defaults for most actions with a repo in Cobbler.

Getter

The breed detected.

Setter

May raise a ValueError or TypeError in case the given value is wrong.

check_if_valid() None[source]

Checks if the object is valid. Currently checks for name and mirror to be present.

Raises

CX – In case the name or mirror is missing.

property createrepo_flags: str

Flags passed to createrepo when it is called. Common flags to use would be -c cache or -g comps.xml to generate group information.

Note

This property can be set to <<inherit>>.

Getter

The createrepo_flags to apply to the repo.

Setter

The new flags. May raise a TypeError in case the options are not a str.

property environment: Dict[Any, Any]

Yum can take options from the environment. This puts them there before each reposync.

Getter

The options to be attached to the environment.

Setter

May raise a ValueError in case the data provided is not parsable.

property keep_updated: bool

This allows the user to disable updates to a particular repo for whatever reason.

Getter

True in case the repo is updated automatically and False otherwise.

Setter

Is auto-converted to a bool via multiple types. Raises a TypeError if this was not possible.

make_clone() Repo[source]

Clone this file object. Please manually adjust all value yourself to make the cloned object unique.

Returns

The cloned instance of this object.

property mirror: str

A repo is (initially, as in right now) is something that can be rsynced. reposync/repotrack integration over HTTP might come later.

Getter

The mirror uri.

Setter

May raise a TypeError in case we run into

property mirror_locally: bool

If this property is set to True then all content of the source is mirrored locally. This may take up a lot of disk space.

Getter

Whether the mirror is locally available or not.

Setter

Raises a TypeError in case after the conversion of the value is not of type bool.

property mirror_type: MirrorType

Override the mirror_type used for reposync

Getter

The mirror type. Is one of the predefined ones.

Setter

Hand over a str or enum type value to this. May raise TypeError or ValueError in case there are conversion or type problems.

property os_version: str

The operating system version which is compatible with this repository.

Getter

The os version.

Setter

The version as a str.

property priority: int

Set the priority of the repository. Only works if host is using priorities plugin for yum.

Getter

The priority of the repo.

Setter

A number between 1 & 99. May raise otherwise TypeError or ValueError.

property proxy: str

Override the default external proxy which is used for accessing the internet.

Note

This property can be set to <<inherit>>.

Getter

Returns the default one or the specific one for this repository.

Setter

May raise a TypeError in case the wrong value is given.

property rpm_list: List[str]

Rather than mirroring the entire contents of a repository (Fedora Extras, for instance, contains games, and we probably don’t want those), make it possible to list the packages one wants out of those repos, so only those packages and deps can be mirrored.

Getter

The list of packages to be mirrored.

Setter

May be a space delimited list or a real one.

property rsyncopts: Dict[Any, Any]

Options for rsync when being used for repo management.

Getter

The options to apply to the generated ones.

Setter

A str or dict to replace the old options with. If the str can’t be parsed we throw a ValueError.

property yumopts: Dict[Any, Any]

Options for the yum tool. Should be presented in the same way as the kernel_options.

Getter

The dict with the parsed options.

Setter

Either the dict or a str which is then parsed. If parsing is unsuccessful then a ValueError is raised.

8.1.3.8. cobbler.items.system module

All code belonging to Cobbler systems. This includes network interfaces.

Changelog (NetworkInterface):

V3.4.0 (unreleased):
  • Changes:
    • Constructor: kwargs can now be used to seed the item during creation.

    • virt_type: str - Inheritable; One of “qemu”, “kvm”, “xenpv”, “xenfv”, “vmware”, “vmwarew”, “openvz” or “auto”.

V3.3.4 (unreleased):
  • No changes

V3.3.3:
  • Changed:
    • to_dict(): Accepts new parameter resolved

    • virt_bridge: Can now be set to <<inherit>> to get its value from the settings key default_virt_bridge

V3.3.2:
  • No changes

V3.3.1:
  • No changes

V3.3.0:
  • This release switched from pure attributes to properties (getters/setters).

  • Added:
    • NetworkInterface is now a class.

    • Serialization still happens inside the system collection.

    • Properties have been used.

V3.2.2:
  • No changes

V3.2.1:
  • No changes

V3.2.0:
  • No changes

V3.1.2:
  • No changes

V3.1.1:
  • No changes

V3.1.0:
  • No changes

V3.0.1:
  • No changes

V3.0.0:
  • Field defintions now split of System class

V2.8.5:
  • Inital tracking of changes for the changelog.

  • Field definitions part of System class

  • Added:
    • mac_address: str

    • connected_mode: bool

    • mtu: str

    • ip_address: str

    • interface_type: str - One of “na”, “bond”, “bond_slave”, “bridge”, bridge_slave”, “bonded_bridge_slave”, “infiniband”

    • interface_master: str

    • bonding_opts: str

    • bridge_opts: str

    • management: bool

    • static: bool

    • netmask: str

    • if_gateway: str

    • dhcp_tag: str

    • dns_name: str

    • static_routes: List[str]

    • virt_bridge: str

    • ipv6_address: str

    • ipv6_prefix: str

    • ipv6_secondaries: List[str]

    • ipv6_mtu: str

    • ipv6_static_routes: List[str]

    • ipv6_default_gateway: str

    • cnames: List[str]

Changelog (System):

V3.4.0 (unreleased):
  • Added:
    • display_name: str

  • Changes:
    • Constructor: kwargs can now be used to seed the item during creation.

    • from_dict(): The method was moved to the base class.

    • parent: The property was moved to the base class.

V3.3.4 (unreleased):
  • Changed:
    • The network interface default is not created on object creation.

V3.3.3:
  • Changed:
    • boot_loaders: Can now be set to <<inherit>>

    • next_server_v4: Can now be set to <<inhertit>>

    • next_server_v6: Can now be set to <<inhertit>>

    • virt_cpus: Can now be set to <<inhertit>>

    • virt_file_size: Can now be set to <<inhertit>>

    • virt_disk_driver: Can now be set to <<inhertit>>

    • virt_auto_boot: Can now be set to <<inhertit>>

    • virt_ram: Can now be set to <<inhertit>>

    • virt_type: Can now be set to <<inhertit>>

    • virt_path: Can now be set to <<inhertit>>

V3.3.2:
  • No changes

V3.3.1:
  • Changed:
    • serial_device: Default value is now -1

V3.3.0:
  • This release switched from pure attributes to properties (getters/setters).

  • Added:
    • next_server_v4

    • next_server_v6

  • Changed:
    • virt_*: Cannot be set to inherit anymore

    • enable_gpxe: Renamed to enable_ipxe

  • Removed:
    • get_fields()

    • next_server - Please use one of next_server_v4 or next_server_v6

    • set_boot_loader() - Moved to boot_loader property

    • set_server() - Moved to server property

    • set_next_server() - Moved to next_server property

    • set_filename() - Moved to filename property

    • set_proxy() - Moved to proxy property

    • set_redhat_management_key() - Moved to redhat_management_key property

    • get_redhat_management_key() - Moved to redhat_management_key property

    • set_dhcp_tag() - Moved to NetworkInterface class property dhcp_tag

    • set_cnames() - Moved to NetworkInterface class property cnames

    • set_status() - Moved to status property

    • set_static() - Moved to NetworkInterface class property static

    • set_management() - Moved to NetworkInterface class property management

    • set_dns_name() - Moved to NetworkInterface class property dns_name

    • set_hostname() - Moved to hostname property

    • set_ip_address() - Moved to NetworkInterface class property ip_address

    • set_mac_address() - Moved to NetworkInterface class property mac_address

    • set_gateway() - Moved to gateway property

    • set_name_servers() - Moved to name_servers property

    • set_name_servers_search() - Moved to name_servers_search property

    • set_netmask() - Moved to NetworkInterface class property netmask

    • set_if_gateway() - Moved to NetworkInterface class property if_gateway

    • set_virt_bridge() - Moved to NetworkInterface class property virt_bridge

    • set_interface_type() - Moved to NetworkInterface class property interface_type

    • set_interface_master() - Moved to NetworkInterface class property interface_master

    • set_bonding_opts() - Moved to NetworkInterface class property bonding_opts

    • set_bridge_opts() - Moved to NetworkInterface class property bridge_opts

    • set_ipv6_autoconfiguration() - Moved to ipv6_autoconfiguration property

    • set_ipv6_default_device() - Moved to ipv6_default_device property

    • set_ipv6_address() - Moved to NetworkInterface class property ipv6_address

    • set_ipv6_prefix() - Moved to NetworkInterface class property ipv6_prefix

    • set_ipv6_secondaries() - Moved to NetworkInterface class property ipv6_secondaries

    • set_ipv6_default_gateway() - Moved to NetworkInterface class property ipv6_default_gateway

    • set_ipv6_static_routes() - Moved to NetworkInterface class property ipv6_static_routes

    • set_ipv6_mtu() - Moved to NetworkInterface class property ipv6_mtu

    • set_mtu() - Moved to NetworkInterface class property mtu

    • set_connected_mode() - Moved to NetworkInterface class property connected_mode

    • set_enable_gpxe() - Moved to enable_gpxe property

    • set_profile() - Moved to profile property

    • set_image() - Moved to image property

    • set_virt_cpus() - Moved to virt_cpus property

    • set_virt_file_size() - Moved to virt_file_size property

    • set_virt_disk_driver() - Moved to virt_disk_driver property

    • set_virt_auto_boot() - Moved to virt_auto_boot property

    • set_virt_pxe_boot() - Moved to virt_pxe_boot property

    • set_virt_ram() - Moved to virt_ram property

    • set_virt_type() - Moved to virt_type property

    • set_virt_path() - Moved to virt_path property

    • set_netboot_enabled() - Moved to netboot_enabled property

    • set_autoinstall() - Moved to autoinstall property

    • set_power_type() - Moved to power_type property

    • set_power_identity_file() - Moved to power_identity_file property

    • set_power_options() - Moved to power_options property

    • set_power_user() - Moved to power_user property

    • set_power_pass() - Moved to power_pass property

    • set_power_address() - Moved to power_address property

    • set_power_id() - Moved to power_id property

    • set_repos_enabled() - Moved to repos_enabled property

    • set_serial_device() - Moved to serial_device property

    • set_serial_baud_rate() - Moved to serial_baud_rate property

V3.2.2:
  • No changes

V3.2.1:
  • Added:
    • kickstart: Resolves as a proxy to autoinstall

V3.2.0:
  • No changes

V3.1.2:
  • Added:
    • filename: str - Inheritable

    • set_filename()

V3.1.1:
  • No changes

V3.1.0:
  • No changes

V3.0.1:
  • File was moved from cobbler/item_system.py to cobbler/items/system.py.

V3.0.0:
  • Field definitions for network interfaces moved to own FIELDS array

  • Added:
    • boot_loader: str - Inheritable

    • next_server: str - Inheritable

    • power_options: str

    • power_identity_file: str

    • serial_device: int

    • serial_baud_rate: int - One of “”, “2400”, “4800”, “9600”, “19200”, “38400”, “57600”, “115200”

    • set_next_server()

    • set_serial_device()

    • set_serial_baud_rate()

    • get_config_filename()

    • set_power_identity_file()

    • set_power_options()

  • Changed:
    • kickstart: Renamed to autoinstall

    • ks_meta: Renamed to autoinstall_meta

    • from_datastruct: Renamed to from_dict()

    • set_kickstart(): Renamed to set_autoinstall()

  • Removed:
    • redhat_management_server

    • set_ldap_enabled()

    • set_monit_enabled()

    • set_template_remote_kickstarts()

    • set_redhat_management_server()

    • set_name()

V2.8.5:
  • Inital tracking of changes for the changelog.

  • Network interface defintions part of this class

  • Added:
    • name: str

    • uid: str

    • owners: List[str] - Inheritable

    • profile: str - Name of the profile

    • image: str - Name of the image

    • status: str - One of “”, “development”, “testing”, “acceptance”, “production”

    • kernel_options: Dict[str, Any]

    • kernel_options_post: Dict[str, Any]

    • ks_meta: Dict[str, Any]

    • enable_gpxe: bool - Inheritable

    • proxy: str - Inheritable

    • netboot_enabled: bool

    • kickstart: str - Inheritable

    • comment: str

    • depth: int

    • server: str - Inheritable

    • virt_path: str - Inheritable

    • virt_type: str - Inheritable; One of “xenpv”, “xenfv”, “qemu”, “kvm”, “vmware”, “openvz”

    • virt_cpus: int - Inheritable

    • virt_file_size: float - Inheritable

    • virt_disk_driver: str - Inheritable; One of “<<inherit>>”, “raw”, “qcow”, “qcow2”, “aio”, “vmdk”, “qed”

    • virt_ram: int - Inheritable

    • virt_auto_boot: bool - Inheritable

    • virt_pxe_boot: bool

    • ctime: float

    • mtime: float

    • power_type: str - Default loaded from settings key power_management_default_type

    • power_address: str

    • power_user: str

    • power_pass: str

    • power_id: str

    • hostname: str

    • gateway: str

    • name_servers: List[str]

    • name_servers_search: List[str]

    • ipv6_default_device: str

    • ipv6_autoconfiguration: bool

    • mgmt_classes: List[Any] - Inheritable

    • mgmt_parameters: str - Inheritable

    • boot_files: Dict[str, Any]/List (Not reverse engineeriable) - Inheritable

    • fetchable_files: Dict[str, Any] - Inheritable

    • template_files: Dict[str, Any] - Inheritable

    • redhat_management_key: str - Inheritable

    • redhat_management_server: str - Inheritable

    • template_remote_kickstarts: bool - Default loaded from settings key template_remote_kickstarts

    • repos_enabled: bool

    • ldap_enabled: - bool

    • ldap_type: str - Default loaded from settings key ldap_management_default_type

    • monit_enabled: bool

class cobbler.items.system.NetworkInterface(api: CobblerAPI, *args: Any, **kwargs: Any)[source]

Bases: object

A subobject of a Cobbler System which represents the network interfaces

property bonding_opts: str

bonding_opts property.

Getter

Returns the value for bonding_opts.

Setter

Sets the value for the property bonding_opts.

property bridge_opts: str

bridge_opts property.

Getter

Returns the value for bridge_opts.

Setter

Sets the value for the property bridge_opts.

property cnames: List[str]

cnames property.

Getter

Returns the value for cnames.

Setter

Sets the value for the property cnames.

property connected_mode: bool

connected_mode property.

Getter

Returns the value for connected_mode.

Setter

Sets the value for the property connected_mode.

deserialize(interface_dict: Dict[str, Any])[source]

This is currently a proxy for from_dict() .

Parameters

interface_dict – The dictionary with the data to deserialize.

property dhcp_tag: str

dhcp_tag property.

Getter

Returns the value for dhcp_tag.

Setter

Sets the value for the property dhcp_tag.

property dns_name: str

dns_name property.

Getter

Returns the value for ``dns_name`.

Setter

Sets the value for the property dns_name.

from_dict(dictionary: Dict[str, Any])[source]

Initializes the object with attributes from the dictionary.

Parameters

dictionary – The dictionary with values.

property if_gateway: str

if_gateway property.

Getter

Returns the value for if_gateway.

Setter

Sets the value for the property if_gateway.

property interface_master: str

interface_master property.

Getter

Returns the value for interface_master.

Setter

Sets the value for the property interface_master.

property interface_type: NetworkInterfaceType

interface_type property.

Getter

Returns the value for interface_type.

Setter

Sets the value for the property interface_type.

property ip_address: str

ip_address property.

Getter

Returns the value for ip_address.

Setter

Sets the value for the property ip_address.

property ipv6_address: str

ipv6_address property.

Getter

Returns the value for ipv6_address.

Setter

Sets the value for the property ipv6_address.

property ipv6_default_gateway: str

ipv6_default_gateway property.

Getter

Returns the value for ipv6_default_gateway.

Setter

Sets the value for the property ipv6_default_gateway.

property ipv6_mtu: str

ipv6_mtu property.

Getter

Returns the value for ipv6_mtu.

Setter

Sets the value for the property ipv6_mtu.

property ipv6_prefix: str

ipv6_prefix property.

Getter

Returns the value for ipv6_prefix.

Setter

Sets the value for the property ipv6_prefix.

property ipv6_secondaries: List[str]

ipv6_secondaries property.

Getter

Returns the value for ipv6_secondaries.

Setter

Sets the value for the property ipv6_secondaries.

property ipv6_static_routes: List[str]

ipv6_static_routes property.

Getter

Returns the value for ipv6_static_routes.

Setter

Sets the value for the property ipv6_static_routes`.

property mac_address: str

mac_address property.

Getter

Returns the value for mac_address.

Setter

Sets the value for the property mac_address.

property management: bool

management property.

Getter

Returns the value for management.

Setter

Sets the value for the property management.

modify_interface(_dict: Dict[str, Any])[source]

Modify the interface

Parameters

_dict – The dict with the parameter.

property mtu: str

mtu property.

Getter

Returns the value for mtu.

Setter

Sets the value for the property mtu.

property netmask: str

netmask property.

Getter

Returns the value for netmask.

Setter

Sets the value for the property netmask.

serialize() Dict[str, Any][source]

This method is a proxy for to_dict() and contains additional logic for serialization to a persistent location.

Returns

The dictionary with the information for serialization.

property static: bool

static property.

Getter

Returns the value for static.

Setter

Sets the value for the property static.

property static_routes: List[str]

static_routes property.

Getter

Returns the value for static_routes.

Setter

Sets the value for the property static_routes.

to_dict(resolved: bool = False) Dict[str, Any][source]

This converts everything in this object to a dictionary.

Parameters

resolved – If this is True, Cobbler will resolve the values to its final form, rather than give you the objects raw value.

Returns

A dictionary with all values present in this object.

property virt_bridge: str

virt_bridge property. If set to <<inherit>> this will read the value from the setting “default_virt_bridge”.

Getter

Returns the value for virt_bridge.

Setter

Sets the value for the property virt_bridge.

class cobbler.items.system.System(api: CobblerAPI, *args: Any, **kwargs: Any)[source]

Bases: Item

A Cobbler system object.

COLLECTION_TYPE = 'system'
TYPE_NAME = 'system'
property autoinstall: str

autoinstall property.

Getter

Returns the value for autoinstall.

Setter

Sets the value for the property autoinstall.

property boot_loaders: List[str]

boot_loaders property.

Note

This property can be set to <<inherit>>.

Getter

Returns the value for boot_loaders.

Setter

Sets the value for the property boot_loaders.

check_if_valid()[source]

Checks if the current item passes logical validation.

Raises

CX – In case name is missing. Additionally either image or profile is required.

delete_interface(name: Union[str, Dict[Any, Any]]) None[source]

Used to remove an interface.

Raises

TypeError – If the name of the interface is not of type str or dict.

property display_name: str

Returns the display name.

Getter

Returns the display name for the boot menu.

Setter

Sets the display name for the boot menu.

property enable_ipxe: bool

enable_ipxe property.

Note

This property can be set to <<inherit>>.

Getter

Returns the value for enable_ipxe.

Setter

Sets the value for the property enable_ipxe.

property filename: str

filename property.

Getter

Returns the value for filename.

Setter

Sets the value for the property filename.

property gateway

gateway property.

Getter

Returns the value for gateway.

Setter

Sets the value for the property gateway.

get_config_filename(interface: str, loader: Optional[str] = None) Optional[str][source]

The configuration file for each system pxe uses is either a form of the MAC address or the hex version or the IP address. If none of that is available, just use the given name, though the name given will be unsuitable for PXE configuration (For this, check system.is_management_supported()). This same file is used to store system config information in the Apache tree, so it’s still relevant.

Parameters
  • interface – Name of the interface.

  • loader – Bootloader type.

get_ip_address(interface: str) str[source]

Get the IP address for the given interface.

Parameters

interface – The name of the interface to get the IP address of.

get_mac_address(interface: str)[source]

Get the mac address, which may be implicit in the object name or explicit with –mac-address. Use the explicit location first.

Parameters

interface – The name of the interface to get the MAC of.

property hostname: str

hostname property.

Getter

Returns the value for hostname.

Setter

Sets the value for the property hostname.

property image: str

image property.

Getter

Returns the value for image.

Setter

Sets the value for the property image.

property interfaces: Dict[str, NetworkInterface]

Represents all interfaces owned by the system.

Getter

The interfaces present. Has at least the default one.

Setter

Accepts not only the correct type but also a dict with dicts which will then be converted by the setter.

property ipv6_autoconfiguration: bool

ipv6_autoconfiguration property.

Getter

Returns the value for ipv6_autoconfiguration.

Setter

Sets the value for the property ipv6_autoconfiguration.

property ipv6_default_device: str

ipv6_default_device property.

Getter

Returns the value for ipv6_default_device.

Setter

Sets the value for the property ipv6_default_device.

is_management_supported(cidr_ok: bool = True) bool[source]

Can only add system PXE records if a MAC or IP address is available, else it’s a koan only record.

Parameters

cidr_ok – Deprecated parameter which is not used anymore.

make_clone()[source]

Must be defined in any subclass

modify_interface(interface_values: Dict[str, Any])[source]

Modifies a magic interface dictionary in the form of: {“macaddress-eth0” : “aa:bb:cc:dd:ee:ff”}

property name_servers: List[str]

name_servers property. FIXME: Differentiate between IPv4/6

Getter

Returns the value for name_servers.

Setter

Sets the value for the property name_servers.

name_servers_search property.

Getter

Returns the value for name_servers_search.

Setter

Sets the value for the property name_servers_search.

property netboot_enabled: bool

netboot_enabled property.

Getter

Returns the value for netboot_enabled.

Setter

Sets the value for the property netboot_enabled.

property next_server_v4: str

next_server_v4 property.

Note

This property can be set to <<inherit>>.

Getter

Returns the value for next_server_v4.

Setter

Sets the value for the property next_server_v4.

property next_server_v6: str

next_server_v6 property.

Note

This property can be set to <<inherit>>.

Getter

Returns the value for next_server_v6.

Setter

Sets the value for the property next_server_v6.

property power_address: str

power_address property.

Getter

Returns the value for power_address.

Setter

Sets the value for the property power_address.

property power_id: str

power_id property.

Getter

Returns the value for power_id.

Setter

Sets the value for the property power_id.

property power_identity_file: str

power_identity_file property.

Getter

Returns the value for power_identity_file.

Setter

Sets the value for the property power_identity_file.

property power_options: str

power_options property.

Getter

Returns the value for power_options.

Setter

Sets the value for the property power_options.

property power_pass: str

power_pass property.

Getter

Returns the value for power_pass.

Setter

Sets the value for the property power_pass.

property power_type: str

power_type property.

Getter

Returns the value for power_type.

Setter

Sets the value for the property power_type.

property power_user: str

power_user property.

Getter

Returns the value for power_user.

Setter

Sets the value for the property power_user.

property profile: str

profile property.

Getter

Returns the value for profile.

Setter

Sets the value for the property profile.

property proxy: str

proxy property. This corresponds per default to the setting``proxy_url_int``.

Note

This property can be set to <<inherit>>.

Getter

Returns the value for proxy.

Setter

Sets the value for the property proxy.

property redhat_management_key: str

redhat_management_key property.

Note

This property can be set to <<inherit>>.

Getter

Returns the value for redhat_management_key.

Setter

Sets the value for the property redhat_management_key.

rename_interface(old_name: str, new_name: str)[source]

Used to rename an interface.

Raises
  • TypeError – In case on of the params was not a str.

  • ValueError – In case the name for the old interface does not exist or the new name does.

property repos_enabled: bool

repos_enabled property.

Getter

Returns the value for repos_enabled.

Setter

Sets the value for the property repos_enabled.

property serial_baud_rate: BaudRates

serial_baud_rate property. The value “disabled” will disable the functionality completely.

Getter

Returns the value for serial_baud_rate.

Setter

Sets the value for the property serial_baud_rate.

property serial_device: int

serial_device property. “-1” disables the serial device functionality completely.

Getter

Returns the value for serial_device.

Setter

Sets the value for the property serial_device.

property server: str

server property.

Note

This property can be set to <<inherit>>.

Getter

Returns the value for server.

Setter

Sets the value for the property server.

property status: str

status property.

Getter

Returns the value for status.

Setter

Sets the value for the property status.

property virt_auto_boot: bool

virt_auto_boot property.

Note

This property can be set to <<inherit>>.

Getter

Returns the value for virt_auto_boot.

Setter

Sets the value for the property virt_auto_boot.

property virt_cpus: int

virt_cpus property.

Note

This property can be set to <<inherit>>.

Getter

Returns the value for virt_cpus.

Setter

Sets the value for the property virt_cpus.

property virt_disk_driver: VirtDiskDrivers

virt_disk_driver property.

Note

This property can be set to <<inherit>>.

Getter

Returns the value for virt_disk_driver.

Setter

Sets the value for the property virt_disk_driver.

property virt_file_size: float

virt_file_size property.

Note

This property can be set to <<inherit>>.

Getter

Returns the value for virt_file_size.

Setter

Sets the value for the property virt_file_size.

property virt_path: str

virt_path property.

Note

This property can be set to <<inherit>>.

Getter

Returns the value for virt_path.

Setter

Sets the value for the property virt_path.

property virt_pxe_boot: bool

virt_pxe_boot property.

Getter

Returns the value for virt_pxe_boot.

Setter

Sets the value for the property virt_pxe_boot.

property virt_ram: int

virt_ram property.

Note

This property can be set to <<inherit>>.

Getter

Returns the value for virt_ram.

Setter

Sets the value for the property virt_ram.

property virt_type: VirtType

virt_type property.

Note

This property can be set to <<inherit>>.

Getter

Returns the value for virt_type.

Setter

Sets the value for the property virt_type.

8.1.3.9. Module contents

This package contains all data storage classes. The classes are responsible for ensuring that types of the properties are correct but not for logical checks. The classes should be as stupid as possible. Further they are responsible for returning the logic for serializing and deserializing themselves.

Cobbler has a concept of inheritance where an attribute/a property may have the value <<inherit>>. This then takes over the value of the parent item with the exception of dictionaries. Values that are of type dict are always implicitly inherited, to remove a key-value pair from the dictionary in the inheritance chain prefix the key with !.