cobbler.cobbler_collections package

Submodules

cobbler.cobbler_collections.collection module

class cobbler.cobbler_collections.collection.Collection(collection_mgr)[source]

Bases: object

Base class for any serializable list of things.

SEARCH_REKEY = {'dhcp-tag': 'dhcp_tag', 'inherit': 'parent', 'ip': 'ip_address', 'kopts': 'kernel_options', 'kopts_post': 'kernel_options_post', 'mac': 'mac_address', 'netboot-enabled': 'netboot_enabled', 'virt-auto-boot': 'virt_auto_boot', 'virt-bridge': 'virt_bridge', 'virt-cpus': 'virt_cpus', 'virt-disk-driver': 'virt_disk_driver', 'virt-file-size': 'virt_file_size', 'virt-group': 'virt_group', 'virt-host': 'virt_host', 'virt-path': 'virt_path', 'virt-ram': 'virt_ram', 'virt-type': 'virt_type'}
add(ref, save=False, with_copy=False, with_triggers=True, with_sync=True, quick_pxe_update=False, check_for_duplicate_names=False, check_for_duplicate_netinfo=False, logger=None)[source]

Add an object to the collection

with_copy is a bit of a misnomer, but lots of internal add operations can run with “with_copy” as False. True means a real final commit, as if entered from the command line (or basically, by a user).

With with_copy as False, the particular add call might just be being run during deserialization, in which case extra semantics around the add don’t really apply. So, in that case, don’t run any triggers and don’t deal with any actual files.

collection_type()[source]

Returns the string key for the name of the collection (for use in messages for humans)

copy(ref, newname, logger=None)[source]
factory_produce(collection_mgr, seed_data)[source]

Must override in subclass. Factory_produce returns an Item object from dict

find(name=None, return_list=False, no_errors=False, **kargs)[source]

Return first object in the collection that maches all item=’value’ pairs passed, else return None if no objects can be found. When return_list is set, can also return a list. Empty list would be returned instead of None in that case.

from_list(_list)[source]
get(name)[source]

Return object with name in the collection

remove(name, with_delete=True, with_sync=True, with_triggers=True, recursive=False, logger=None)[source]

Remove an item from collection. This method must be overriden in any subclass.

@param: str name (item name) @param: bool with_delete (sync and run triggers) @param: bool with_sync (sync to server file system) @param: bool with_triggers (run “on delete” triggers) @param: bool recursive (recursively delete children) @param: clogger logger (logger object) @returns: NotImplementedException

rename(ref, newname, with_sync=True, with_triggers=True, logger=None)[source]

Allows an object “ref” to be given a newname without affecting the rest of the object tree.

to_list()[source]

Serialize the collection

to_string()[source]

Creates a printable representation of the collection suitable for reading by humans or parsing from scripts. Actually scripts would be better off reading the JSON in the cobbler_collections files directly.

cobbler.cobbler_collections.distros module

class cobbler.cobbler_collections.distros.Distros(collection_mgr)[source]

Bases: cobbler.cobbler_collections.collection.Collection

A distro represents a network bootable matched set of kernels and initrd files.

collection_type()[source]

Returns the string key for the name of the collection (for use in messages for humans)

factory_produce(collection_mgr, item_dict)[source]

Return a Distro forged from item_dict

remove(name, with_delete=True, with_sync=True, with_triggers=True, recursive=False, logger=None)[source]

Remove element named ‘name’ from the collection

cobbler.cobbler_collections.files 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.cobbler_collections.files.Files(collection_mgr)[source]

Bases: cobbler.cobbler_collections.collection.Collection

Files provide a container for file resources.

collection_type()[source]

Returns the string key for the name of the collection (for use in messages for humans)

factory_produce(collection_mgr, item_dict)[source]

Return a File forged from item_dict

remove(name, with_delete=True, with_sync=True, with_triggers=True, recursive=False, logger=None)[source]

Remove element named ‘name’ from the collection

cobbler.cobbler_collections.images module

class cobbler.cobbler_collections.images.Images(collection_mgr)[source]

Bases: cobbler.cobbler_collections.collection.Collection

A image instance represents a ISO or virt image we want to track and repeatedly install. It differs from a answer-file based installation.

collection_type()[source]

Returns the string key for the name of the collection (for use in messages for humans)

factory_produce(collection_mgr, item_dict)[source]

Return a Distro forged from item_dict

remove(name, with_delete=True, with_sync=True, with_triggers=True, recursive=True, logger=None)[source]

Remove element named ‘name’ from the collection

cobbler.cobbler_collections.manager module

Repository of the Cobbler object model

class cobbler.cobbler_collections.manager.CollectionManager(api)[source]

Bases: object

deserialize()[source]

Load all cobbler_collections from disk

@raise CX if there is an error in deserialization

distros()[source]

Return the definitive copy of the Distros collection

files()[source]

Return the definitive copy of the Files collection

generate_uid()[source]

Cobbler itself does not use this GUID’s though they are provided to allow for easier API linkage with other applications. Cobbler uses unique names in each collection as the object id aka primary key

get_items(collection_type)[source]
has_loaded = False
images()[source]

Return the definitive copy of the Images collection

mgmtclasses()[source]

Return the definitive copy of the Mgmtclasses collection

packages()[source]

Return the definitive copy of the Packages collection

profiles()[source]

Return the definitive copy of the Profiles collection

repos()[source]

Return the definitive copy of the Repos collection

serialize()[source]

Save all cobbler_collections to disk

serialize_delete(collection, item)[source]

Delete a collection item from disk

@param Collection collection collection @param Item item collection item

serialize_item(collection, item)[source]

Save a collection item to disk

@param Collection collection Collection @param Item item collection item

settings()[source]

Return the definitive copy of the application settings

systems()[source]

Return the definitive copy of the Systems collection

cobbler.cobbler_collections.mgmtclasses module

class cobbler.cobbler_collections.mgmtclasses.Mgmtclasses(collection_mgr)[source]

Bases: cobbler.cobbler_collections.collection.Collection

A mgmtclass provides a container for management resources.

collection_type()[source]

Returns the string key for the name of the collection (for use in messages for humans)

factory_produce(config, item_dict)[source]

Return a mgmtclass forged from item_dict

remove(name, with_delete=True, with_sync=True, with_triggers=True, recursive=False, logger=None)[source]

Remove element named ‘name’ from the collection

cobbler.cobbler_collections.packages module

class cobbler.cobbler_collections.packages.Packages(collection_mgr)[source]

Bases: cobbler.cobbler_collections.collection.Collection

A package provides a container for package resources.

collection_type()[source]

Returns the string key for the name of the collection (for use in messages for humans)

factory_produce(collection_mgr, item_dict)[source]

Return a Package forged from item_dict

remove(name, with_delete=True, with_sync=True, with_triggers=True, recursive=False, logger=None)[source]

Remove element named ‘name’ from the collection

cobbler.cobbler_collections.profiles module

class cobbler.cobbler_collections.profiles.Profiles(collection_mgr)[source]

Bases: cobbler.cobbler_collections.collection.Collection

A profile represents a distro paired with an automatic OS installation template file.

collection_type()[source]

Returns the string key for the name of the collection (for use in messages for humans)

factory_produce(collection_mgr, item_dict)[source]

Return a Distro forged from item_dict

remove(name, with_delete=True, with_sync=True, with_triggers=True, recursive=False, logger=None)[source]

Remove element named ‘name’ from the collection

cobbler.cobbler_collections.repos module

class cobbler.cobbler_collections.repos.Repos(collection_mgr)[source]

Bases: cobbler.cobbler_collections.collection.Collection

Repositories in cobbler are way to create a local mirror of a yum repository. When used in conjunction with a mirrored distro tree (see “cobbler import”), outside bandwidth needs can be reduced and/or eliminated.

collection_type()[source]

Returns the string key for the name of the collection (for use in messages for humans)

factory_produce(config, item_dict)[source]

Return a Distro forged from item_dict

remove(name, with_delete=True, with_sync=True, with_triggers=True, recursive=False, logger=None)[source]

Remove element named ‘name’ from the collection

cobbler.cobbler_collections.systems module

class cobbler.cobbler_collections.systems.Systems(collection_mgr)[source]

Bases: cobbler.cobbler_collections.collection.Collection

Systems are hostnames/MACs/IP names and the associated profile they belong to.

collection_type()[source]

Returns the string key for the name of the collection (for use in messages for humans)

factory_produce(collection_mgr, item_dict)[source]

Return a Distro forged from item_dict

remove(name, with_delete=True, with_sync=True, with_triggers=True, recursive=False, logger=None)[source]

Remove element named ‘name’ from the collection

Module contents