8.1.3. cobbler.items package

8.1.3.1. Submodules

8.1.3.2. cobbler.items.distro module

class cobbler.items.distro.Distro(*args, **kwargs)[source]

Bases: cobbler.items.item.Item

A cobbler distribution object

COLLECTION_TYPE = 'distro'
TYPE_NAME = 'distro'
check_if_valid()[source]

Raise exceptions if the object state is inconsistent

get_arch()[source]

Return the architecture of the distribution

get_fields()[source]

Return the list of fields and their properties

get_parent()[source]

Distros don’t have parent objects.

get_redhat_management_key()[source]
make_clone()[source]

Must be defined in any subclass

set_arch(arch)[source]

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”.

set_boot_loader(name)[source]
set_breed(breed)[source]
set_initrd(initrd)[source]

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

set_kernel(kernel)[source]

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

set_os_version(os_version)[source]
set_redhat_management_key(management_key)[source]
set_source_repos(repos)[source]

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.

set_supported_boot_loaders(supported_boot_loaders)[source]

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

set_tree_build_time(datestamp)[source]

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

8.1.3.3. cobbler.items.file module

class cobbler.items.file.File(collection_mgr, is_subobject=False)[source]

Bases: cobbler.resource.Resource

A Cobbler file object.

COLLECTION_TYPE = 'file'
TYPE_NAME = 'file'
check_if_valid()[source]

Insure name, path, owner, group, and mode are set. Templates are only required for files, is_dir = False

get_fields()[source]

Get serializable fields Must be defined in any subclass

make_clone()[source]

Must be defined in any subclass

set_is_dir(is_dir)[source]

If true, treat file resource as a directory. Templates are ignored.

8.1.3.4. cobbler.items.image module

class cobbler.items.image.Image(collection_mgr, is_subobject=False)[source]

Bases: cobbler.items.item.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'
get_fields()[source]

Get serializable fields Must be defined in any subclass

get_parent()[source]

Images have no parent object.

get_valid_image_types()[source]
make_clone()[source]

Must be defined in any subclass

set_arch(arch)[source]

The field is mainly relevant to PXE provisioning. see comments for set_arch in item_distro.py, this works the same.

set_autoinstall(autoinstall)[source]

Set 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.

@param str local automatic installation template file path

set_breed(breed)[source]
set_file(filename)[source]

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

set_image_type(image_type)[source]

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)

set_network_count(num)[source]
set_os_version(os_version)[source]
set_virt_auto_boot(num)[source]
set_virt_bridge(vbridge)[source]
set_virt_cpus(num)[source]
set_virt_disk_driver(driver)[source]
set_virt_file_size(num)[source]
set_virt_path(path)[source]
set_virt_ram(num)[source]
set_virt_type(vtype)[source]

8.1.3.5. cobbler.items.item module

class cobbler.items.item.Item(collection_mgr, is_subobject=False)[source]

Bases: object

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

TYPE_NAME = 'generic'
check_if_valid()[source]

Raise exceptions if the object state is inconsistent

clear(is_subobject=False)[source]

Reset this object.

converted_cache = {}
dump_vars(data, format=True)[source]
find_match(kwargs, no_errors=False)[source]
find_match_single_key(data, key, value, no_errors=False)[source]
from_dict(_dict)[source]

Modify this object to take on values in seed_data

get_children(sorted=True)[source]

Get direct children of this object.

get_conceptual_parent()[source]

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

get_descendants(sort=False)[source]

Get objects that depend on this object, i.e. those that would be affected by a cascading delete, etc. With sort=True the list will be a walk of the tree, e.g., distro -> [profile, sys, sys, profile, sys, sys]

get_fields()[source]

Get serializable fields Must be defined in any subclass

classmethod get_from_cache(ref)[source]
get_parent()[source]

For objects with a tree relationship, what’s the parent object?

get_setter_methods()[source]
make_clone()[source]

Must be defined in any subclass

classmethod remove_from_cache(ref)[source]
set_autoinstall_meta(options)[source]

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

set_boot_files(boot_files)[source]

A comma seperated list of req_name=source_file_path that should be fetchable via tftp

classmethod set_cache(ref, value)[source]
set_comment(comment)[source]
set_ctime(ctime)[source]
set_depth(depth)[source]
set_fetchable_files(fetchable_files)[source]

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

set_kernel_options(options)[source]

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

set_kernel_options_post(options)[source]

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

set_mgmt_classes(mgmt_classes)[source]

Assigns a list of configuration management classes that can be assigned to any object, such as those used by Puppet’s external_nodes feature.

set_mgmt_parameters(mgmt_parameters)[source]

A YAML string which can be assigned to any object, this is used by Puppet’s external_nodes feature.

set_mtime(mtime)[source]
set_name(name)[source]

Set the objects name.

@param: str name (object name string) @returns: True or CX

set_owners(data)[source]

The owners field is a comment unless using an authz module that pays attention to it, like authz_ownership, which ships with Cobbler but is off by default.

set_parent(parent)[source]
set_template_files(template_files)[source]

A comma seperated list of source=destination templates that should be generated during a sync.

set_uid(uid)[source]
sort_key(sort_fields=[])[source]
to_dict()[source]
to_string()[source]

8.1.3.6. cobbler.items.mgmtclass module

class cobbler.items.mgmtclass.Mgmtclass(*args, **kwargs)[source]

Bases: cobbler.items.item.Item

COLLECTION_TYPE = 'mgmtclass'
TYPE_NAME = 'mgmtclass'
check_if_valid()[source]

Raise exceptions if the object state is inconsistent

get_fields()[source]

Get serializable fields Must be defined in any subclass

make_clone()[source]

Must be defined in any subclass

set_class_name(name)[source]
set_files(files)[source]
set_is_definition(isdef)[source]
set_packages(packages)[source]
set_params(params)[source]

8.1.3.7. cobbler.items.package module

class cobbler.items.package.Package(collection_mgr, is_subobject=False)[source]

Bases: cobbler.resource.Resource

COLLECTION_TYPE = 'package'
TYPE_NAME = 'package'
check_if_valid()[source]

Raise exceptions if the object state is inconsistent

get_fields()[source]

Get serializable fields Must be defined in any subclass

make_clone()[source]

Must be defined in any subclass

set_installer(installer)[source]
set_version(version)[source]

8.1.3.8. cobbler.items.profile module

class cobbler.items.profile.Profile(*args, **kwargs)[source]

Bases: cobbler.items.item.Item

A Cobbler profile object.

COLLECTION_TYPE = 'profile'
TYPE_NAME = 'profile'
check_if_valid()[source]

Raise exceptions if the object state is inconsistent

get_arch()[source]
get_fields()[source]

Return the list of fields and their properties

get_parent()[source]

Return object next highest up the tree.

get_redhat_management_key()[source]
make_clone()[source]

Must be defined in any subclass

set_autoinstall(autoinstall)[source]

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

@param str local automatic installation template path

set_dhcp_tag(dhcp_tag)[source]
set_distro(distro_name)[source]

Sets the distro. This must be the name of an existing Distro object in the Distros collection.

set_enable_gpxe(enable_gpxe)[source]

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

set_enable_menu(enable_menu)[source]

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

set_name_servers(data)[source]

Set the DNS servers.

@param: str/list data (string or list of nameservers) @returns: True or CX

Set the DNS search paths.

@param: str/list data (string or list of search domains) @returns: True or CX

set_next_server(server)[source]
set_parent(parent_name)[source]

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 with is_subobject=True or the default values for everything will be screwed up and this will likely NOT work. So, API users – make sure you pass is_subobject=True into the constructor when using this.

set_proxy(proxy)[source]
set_redhat_management_key(management_key)[source]
set_repos(repos, bypass_check=False)[source]
set_server(server)[source]
set_virt_auto_boot(num)[source]
set_virt_bridge(vbridge)[source]
set_virt_cpus(num)[source]
set_virt_disk_driver(driver)[source]
set_virt_file_size(num)[source]
set_virt_path(path)[source]
set_virt_ram(num)[source]
set_virt_type(vtype)[source]

8.1.3.9. cobbler.items.repo module

class cobbler.items.repo.Repo(*args, **kwargs)[source]

Bases: cobbler.items.item.Item

A Cobbler repo object.

COLLECTION_TYPE = 'repo'
TYPE_NAME = 'repo'
check_if_valid()[source]

Raise exceptions if the object state is inconsistent

get_fields()[source]

Get serializable fields Must be defined in any subclass

get_parent()[source]

currently the Cobbler object space does not support subobjects of this object as it is conceptually not useful.

make_clone()[source]

Must be defined in any subclass

set_apt_components(value)[source]
set_apt_dists(value)[source]
set_arch(arch)[source]

Override the arch used for reposync

set_breed(breed)[source]
set_createrepo_flags(createrepo_flags)[source]

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

set_environment(options)[source]

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

set_keep_updated(keep_updated)[source]

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

set_mirror(mirror)[source]

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

set_mirror_locally(value)[source]
set_os_version(os_version)[source]
set_priority(priority)[source]

Set the priority of the repository. 1= highest, 99=default Only works if host is using priorities plugin for yum.

set_proxy(value)[source]
set_rpm_list(rpms)[source]

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 + deps can be mirrored.

set_yumopts(options)[source]

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

8.1.3.10. cobbler.items.system module

class cobbler.items.system.System(*args, **kwargs)[source]

Bases: cobbler.items.item.Item

A Cobbler system object.

COLLECTION_TYPE = 'system'
TYPE_NAME = 'system'
check_if_valid()[source]

Raise exceptions if the object state is inconsistent

delete_interface(name)[source]

Used to remove an interface.

from_dict(seed_data)[source]

Modify this object to take on values in seed_data

get_config_filename(interface, loader=None)[source]

The configuration file for each system pxe uses is either a form of the MAC address of the hex version of the IP. 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
  • loader (str) – Bootloader type.

  • interface (str) – Name of the interface.

get_fields()[source]

Get serializable fields Must be defined in any subclass

get_ip_address(interface)[source]

Get the IP address for the given interface.

get_mac_address(interface)[source]

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

get_parent()[source]

Return object next highest up the tree.

get_redhat_management_key()[source]
is_management_supported(cidr_ok=True)[source]

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

make_clone()[source]

Must be defined in any subclass

modify_interface(_dict)[source]

Used by the WUI to modify an interface more-efficiently

rename_interface(names)[source]

Used to rename an interface.

set_autoinstall(autoinstall)[source]

Set the automatic installation template filepath, this must be a local file.

@param str local automatic installation template file path

set_bonding_opts(bonding_opts, interface)[source]
set_boot_loader(name)[source]
set_bridge_opts(bridge_opts, interface)[source]
set_cnames(cnames, interface)[source]
set_connected_mode(truthiness, interface)[source]
set_dhcp_tag(dhcp_tag, interface)[source]
set_dns_name(dns_name, interface)[source]

Set DNS name for interface.

@param: str dns_name (dns name) @param: str interface (interface name) @returns: True or CX

set_enable_gpxe(enable_gpxe)[source]

Sets whether or not the system will use gPXE for booting.

set_gateway(gateway)[source]

Set a gateway IPv4 address.

@param: str gateway (ip address) @returns: True or CX

set_hostname(hostname)[source]

Set hostname.

@param: str hostname (hostname for system) @returns: True or CX

set_if_gateway(gateway, interface)[source]

Set the per-interface gateway.

@param: str gateway (ipv4 address for the gateway) @param: str interface (interface name) @returns: True or CX

set_image(image_name)[source]

Set the system to use a certain named image. Works like set_profile but cannot be used at the same time. It’s one or the other.

set_interface_master(interface_master, interface)[source]
set_interface_type(type, interface)[source]
set_ip_address(address, interface)[source]

Set IPv4 address on interface.

@param: str address (ip address) @param: str interface (interface name) @returns: True or CX

set_ipv6_address(address, interface)[source]

Set IPv6 address on interface.

@param: str address (ip address) @param: str interface (interface name) @returns: True or CX

set_ipv6_autoconfiguration(truthiness)[source]
set_ipv6_default_device(interface_name)[source]
set_ipv6_default_gateway(address, interface)[source]
set_ipv6_mtu(mtu, interface)[source]
set_ipv6_prefix(prefix, interface)[source]

Assign a IPv6 prefix

set_ipv6_secondaries(addresses, interface)[source]
set_ipv6_static_routes(routes, interface)[source]
set_mac_address(address, interface)[source]

Set mac address on interface.

@param: str address (mac address) @param: str interface (interface name) @returns: True or CX

set_management(truthiness, interface)[source]
set_mtu(mtu, interface)[source]
set_name_servers(data)[source]

Set the DNS servers.

@param: str/list data (string or list of nameservers) @returns: True or CX

Set the DNS search paths.

@param: str/list data (string or list of search domains) @returns: True or CX

set_netboot_enabled(netboot_enabled)[source]

If true, allows per-system PXE files to be generated on sync (or add). If false, these files are not generated, thus eliminating the potential for an infinite install loop when systems are set to PXE boot first in the boot order. In general, users who are PXE booting first in the boot order won’t create system definitions, so this feature primarily comes into play for programmatic users of the API, who want to initially create a system with netboot enabled and then disable it after the system installs, as triggered by some action in automatic installation file’s %post section. For this reason, this option is not urfaced in the CLI, output, or documentation (yet).

Use of this option does not affect the ability to use PXE menus. If an admin has machines set up to PXE only after local boot fails, this option isn’t even relevant.

set_netmask(netmask, interface)[source]

Set the netmask for given interface.

@param: str netmask (netmask) @param: str interface (interface name) @returns: True or CX

set_next_server(server)[source]
set_power_address(power_address)[source]
set_power_id(power_id)[source]
set_power_identity_file(power_identity_file)[source]
set_power_options(power_options)[source]
set_power_pass(power_pass)[source]
set_power_type(power_type)[source]
set_power_user(power_user)[source]
set_profile(profile_name)[source]

Set the system to use a certain named profile. The profile must have already been loaded into the Profiles collection.

set_proxy(proxy)[source]
set_redhat_management_key(management_key)[source]
set_repos_enabled(repos_enabled)[source]
set_serial_baud_rate(baud_rate)[source]
set_serial_device(device_number)[source]
set_server(server)[source]

If a system can’t reach the boot server at the value configured in settings because it doesn’t have the same name on it’s subnet this is there for an override.

set_static(truthiness, interface)[source]
set_static_routes(routes, interface)[source]
set_status(status)[source]
set_virt_auto_boot(num)[source]
set_virt_bridge(bridge, interface)[source]
set_virt_cpus(num)[source]
set_virt_disk_driver(driver)[source]
set_virt_file_size(num)[source]
set_virt_path(path)[source]
set_virt_pxe_boot(num)[source]
set_virt_ram(num)[source]
set_virt_type(vtype)[source]

8.1.3.11. Module contents