9.1.3. cobbler.items package
9.1.3.1. Submodules
9.1.3.2. cobbler.items.distro module
Copyright 2006-2009, Red Hat, Inc and Others Michael DeHaan <michael.dehaan AT gmail>
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- class cobbler.items.distro.Distro(api, *args, **kwargs)[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
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
orValueError
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
orTypeError
in case the given value is wrong.
- property children: list
This property represents all children of a distribution. It should not be set manually.
- Getter:
The children of the distro.
- Setter:
No validation is done because this is a Cobbler internal property.
- from_dict(dictionary: dict)[source]
Initializes the object with attributes from the dictionary.
- Parameters:
dictionary – The dictionary with values.
- 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
orValueError
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
orTypeError
in case of validation errors.
- 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
orValueError
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
orValueError
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
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
Some distributions, particularly on powerpc, can only be netbooted using specific bootloaders.
- Returns:
The bootloaders which are available for being set.
9.1.3.3. cobbler.items.file module
Copyright 2006-2009, MadHatter Kelsey Hightower <kelsey.hightower@gmail.com>
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- class cobbler.items.file.File(api, *args, **kwargs)[source]
Bases:
Resource
A Cobbler file object.
- COLLECTION_TYPE = 'file'
- TYPE_NAME = 'file'
- check_if_valid()[source]
Checks if the object is valid. This is the case if name, path, owner, group, and mode are set. Templates are only required for files if
is_dir
is true then template is not required.- Raises:
CX – Raised in case a required argument is missing
- from_dict(dictionary: dict)[source]
Initializes the object with attributes from the dictionary.
- Parameters:
dictionary – The dictionary with values.
- property is_dir
Is this a directory or not.
- Getter:
Returns the value of
is_dir
- Setter:
Sets the value of
is_dir
. Raises a TypeError in case value is not a boolean.
9.1.3.4. cobbler.items.image module
Copyright 2006-2009, Red Hat, Inc and Others Michael DeHaan <michael.dehaan AT gmail>
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- class cobbler.items.image.Image(api, *args, **kwargs)[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
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 children: list
This property represents all children of an image. It should not be set manually.
- Getter:
The children of the image.
- Setter:
No validation is done because this is a Cobbler internal property.
- 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.
- from_dict(dictionary: dict)[source]
Initializes the object with attributes from the dictionary.
- Parameters:
dictionary – The dictionary with values.
- 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 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
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.
9.1.3.5. cobbler.items.item module
Copyright 2006-2009, Red Hat, Inc and Others Michael DeHaan <michael.dehaan AT gmail>
This software may be freely redistributed under the terms of the GNU general public license.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- class cobbler.items.item.Item(api, is_subobject: bool = False)[source]
Bases:
object
An Item is a serializable thing that can appear in a Collection
- COLLECTION_TYPE = 'generic'
- TYPE_NAME = 'generic'
- property autoinstall_meta: dict
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
Files copied into tftpboot beyond the kernel/initrd
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()
. RaisesTypeError
otherwise.
- check_if_valid()[source]
Raise exceptions if the object state is inconsistent.
- Raises:
CX – In case the name of the item is not set.
- property children: List[str]
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.
- 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
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(item_dict: dict)[source]
This is currently a proxy for
from_dict()
.- Parameters:
item_dict – The dictionary with the data to deserialize.
- dump_vars(formatted_output: bool = True, remove_dicts: bool = False) dict | 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
A comma seperated list of
virt_name=path_to_template
that should be fetchable via tftp or a webserverNote
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()
. RaisesTypeError
otherwise.
- find_match(kwargs, no_errors=False)[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, key, value, 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)[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_children(sort_list: bool = False) List[str] [source]
Get the list of children names.
- Parameters:
sort_list – If the list should be sorted alphabetically or not.
- Returns:
A copy of the list of children names.
- get_conceptual_parent()[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.
- grab_tree() list [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 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
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
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 mgmt_classes: list
Assigns a list of configuration management classes that can be assigned to any object, such as those used by Puppet’s external_nodes feature.
Note
This property can be set to
<<inherit>>
.- Getter:
An empty list or the list of mgmt_classes.
- Setter:
Will split this according to
input_string_or_list()
.
- property mgmt_parameters: dict
Parameters which will be handed to your management application (Must be a valid YAML dictionary)
Note
This property can be set to
<<inherit>>
.- Getter:
The mgmt_parameters or an empty dict.
- Setter:
A YAML string which can be assigned to any object, this is used by Puppet’s external_nodes feature.
- 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
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
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
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.
- serialize() dict [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)[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
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()
. RaisesTypeError
otherwise.
- to_dict(resolved: bool = False) dict [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 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.
9.1.3.7. cobbler.items.mgmtclass module
Copyright 2010, Kelsey Hightower Kelsey Hightower <kelsey.hightower@gmail.com>
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- class cobbler.items.mgmtclass.Mgmtclass(api, *args, **kwargs)[source]
Bases:
Item
This represents a group of systems which are related in Puppet through
Classes
.- COLLECTION_TYPE = 'mgmtclass'
- TYPE_NAME = 'mgmtclass'
- property class_name: str
The name of the management class.
- Getter:
Returns the class name.
- Setter:
Sets the name of the management class. Raises a TypeError or a Value Error.
- property files: list
Files property.
- Getter:
Returns the value for
files
.- Setter:
Sets the value for the property
files
.
- from_dict(dictionary: dict)[source]
Initializes the object with attributes from the dictionary.
- Parameters:
dictionary – The dictionary with values.
- property is_definition: bool
Is_definition property.
- Getter:
Returns the value for
is_definition
.- Setter:
Sets the value for property
is_defintion
. Raises a TypeError if not from type boolean.
- 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.
9.1.3.8. cobbler.items.package module
Copyright 2006-2009, MadHatter Kelsey Hightower <kelsey.hightower@gmail.com>
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- class cobbler.items.package.Package(api, *args, **kwargs)[source]
Bases:
Resource
This class represents a package which is being installed on a system.
- COLLECTION_TYPE = 'package'
- TYPE_NAME = 'package'
- from_dict(dictionary: dict)[source]
Initializes the object with attributes from the dictionary.
- Parameters:
dictionary – The dictionary with values.
- property installer: str
Installer property.
- Getter:
Returns the value for
installer
.- Setter:
Sets the value for property
installer
. Raises a TypeError ifinstaller
is no string.
9.1.3.9. cobbler.items.profile module
Copyright 2006-2009, Red Hat, Inc and Others Michael DeHaan <michael.dehaan AT gmail>
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- class cobbler.items.profile.Profile(api, *args, **kwargs)[source]
Bases:
Item
A Cobbler profile object.
- COLLECTION_TYPE = 'profile'
- TYPE_NAME = 'profile'
- property arch
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
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 children: list
This property represents all children of a distribution. It should not be set manually.
- Getter:
The children of the distro.
- Setter:
No validation is done because this is a Cobbler internal property.
- 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 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 tobool
.
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.
- 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.
- from_dict(dictionary: dict)[source]
Initializes the object with attributes from the dictionary.
- Parameters:
dictionary – The dictionary with values.
- 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 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
Represents the list of nameservers to set for the profile.
- Getter:
The nameservers.
- Setter:
Comma delimited
str
or list with the nameservers.
- property name_servers_search: list
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 typestr
.
- 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 typestr
.
- property parent: Item | None
Instead of a
--distro
, set the parent of this object to another profile and use the values from the parent instead of this one where the values for this profile aren’t filled in, and blend them together where they are dictionaries. Basically this enables profile inheritance. To use this, the object MUST have been constructed withis_subobject=True
or the default values for everything will be screwed up and this will likely NOT work. So, API users – make sure you passis_subobject=True
into the constructor when using this.Return object next highest up the tree. If this property is not set it falls back to the value of the
distro
. In case neither distro nor parent is set, it returns None (which would make the profile invalid).- Getter:
The parent object which can be either another profile, a distro or None in case the object could not be resolved.
- Setter:
The name of the parent object. Might throw a
CX
in case the object could not be found.
- 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: list
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 astr
.
- 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.
9.1.3.10. cobbler.items.repo module
Copyright 2006-2009, Red Hat, Inc and Others Michael DeHaan <michael.dehaan AT gmail>
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- class cobbler.items.repo.Repo(api, *args, **kwargs)[source]
Bases:
Item
A Cobbler repo object.
- COLLECTION_TYPE = 'repo'
- TYPE_NAME = 'repo'
- property apt_components: list
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 reallist
.
- property apt_dists: list
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 reallist
.
- property arch: RepoArchs
Override the arch used for reposync
- Getter:
The repo arch enum object.
- Setter:
May throw a
ValueError
orTypeError
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
orTypeError
in case the given value is wrong.
- check_if_valid()[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 astr
.
- property environment: dict
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.
- from_dict(dictionary: dict)[source]
Initializes the object with attributes from the dictionary.
- Parameters:
dictionary – The dictionary with values.
- 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()[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 typebool
.
- 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
orValueError
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
orValueError
.
- 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
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.
9.1.3.11. cobbler.items.resource module
An Resource is a serializable thing that can appear in a Collection
Copyright 2006-2009, Red Hat, Inc and Others Kelsey Hightower <khightower@gmail.com>
This software may be freely redistributed under the terms of the GNU general public license.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- class cobbler.items.resource.Resource(api, *args, **kwargs)[source]
Bases:
Item
Base Class for management resources.
TODO: Type declarations in the method signatures and type checks in the bodys.
- property action: ResourceAction
Action property.
- Getter:
Return the value for
action
.- Setter:
Sets the value for property
action
. Raises a ValueError or a TypeError.
- from_dict(dictionary: dict)[source]
Initializes the object with attributes from the dictionary.
- Parameters:
dictionary – The dictionary with values.
- property group: str
Group property.
- Getter:
Return the value for
group
.- Setter:
Sets the value for property
group
.
- make_clone()[source]
Clone this file object. Please manually adjust all values yourself to make the cloned object unique.
- Returns:
The cloned instance of this object.
- property mode: str
Mode property.
- Getter:
Return the value for
mode
.- Setter:
Sets the value for property
mode
. Raises a TypeError.
- property owner: str
Owner property.
- Getter:
Return the value for
owner
.- Setter:
Sets the value for property
owner
. Raises a TypeError.
9.1.3.12. cobbler.items.system module
All code belonging to Cobbler systems. This includes network interfaces.
- class cobbler.items.system.NetworkInterface(api)[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
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)[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)[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
ipv6_secondaries property.
- Getter:
Returns the value for
ipv6_secondaries
.- Setter:
Sets the value for the property
ipv6_secondaries
.
- property ipv6_static_routes: list
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)[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()[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
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 [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.
- class cobbler.items.system.System(api, *args, **kwargs)[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
.- Returns:
- property boot_loaders: list
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
.- Returns:
- 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.
- property children: List[str]
children property.
- Getter:
Returns the value for
children
.- Setter:
Sets the value for the property
children
.- Returns:
- delete_interface(name: str | dict)[source]
Used to remove an interface.
- Raises:
TypeError – If the name of the interface is not of type str or dict.
- 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
.- Returns:
- property filename: str
filename property.
- Getter:
Returns the value for
filename
.- Setter:
Sets the value for the property
filename
.
- from_dict(dictionary: dict)[source]
Initializes the object with attributes from the dictionary.
- Parameters:
dictionary – The dictionary with values.
- property gateway
gateway property.
- Getter:
Returns the value for
gateway
.- Setter:
Sets the value for the property
gateway
.- Returns:
- get_config_filename(interface: str, loader: str | None = None)[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)[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
.- Returns:
- property image: str
image property.
- Getter:
Returns the value for
image
.- Setter:
Sets the value for the property
image
.- Returns:
- 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
.- Returns:
- 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
.- Returns:
- 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.
- modify_interface(interface_values: dict)[source]
Modifies a magic interface dictionary in the form of: {“macaddress-eth0” : “aa:bb:cc:dd:ee:ff”}
- property name_servers: list
name_servers property. FIXME: Differentiate between IPv4/6
- Getter:
Returns the value for
name_servers
.- Setter:
Sets the value for the property
name_servers
.- Returns:
- property name_servers_search: list
name_servers_search property.
- Getter:
Returns the value for
name_servers_search
.- Setter:
Sets the value for the property
name_servers_search
.- Returns:
- 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 parent: Item | None
Return object next highest up the tree. This may be a profile or an image.
- Getter:
Returns the value for
parent
.- Setter:
Sets the value for the property
parent
.- Returns:
None when there is no parent or the corresponding Item.
- property power_address: str
power_address property.
- Getter:
Returns the value for
power_address
.- Setter:
Sets the value for the property
power_address
.- Returns:
- property power_id: str
power_id property.
- Getter:
Returns the value for
power_id
.- Setter:
Sets the value for the property
power_id
.- Returns:
- 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
.- Returns:
- property power_options: str
power_options property.
- Getter:
Returns the value for
power_options
.- Setter:
Sets the value for the property
power_options
.- Returns:
- property power_pass: str
power_pass property.
- Getter:
Returns the value for
power_pass
.- Setter:
Sets the value for the property
power_pass
.- Returns:
- property power_type: str
power_type property.
- Getter:
Returns the value for
power_type
.- Setter:
Sets the value for the property
power_type
.- Returns:
- property power_user: str
power_user property.
- Getter:
Returns the value for
power_user
.- Setter:
Sets the value for the property
power_user
.- Returns:
- property profile: str
profile property.
- Getter:
Returns the value for
profile
.- Setter:
Sets the value for the property
profile
.- Returns:
- 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
.- Returns:
- 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
.- Returns:
- 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
.
9.1.3.13. 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.