9.1.2. cobbler.cobbler_collections package
9.1.2.1. Submodules
9.1.2.2. cobbler.cobbler_collections.collection 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.cobbler_collections.collection.Collection(collection_mgr)[source]
Bases:
object
Base class for any serializable list of things.
- SEARCH_REKEY = {'boot_loader': 'boot_loaders', 'dhcp-tag': 'dhcp_tag', 'enable_gpxe': 'enable_ipxe', '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: bool = False, with_copy: bool = False, with_triggers: bool = True, with_sync: bool = True, quick_pxe_update: bool = False, check_for_duplicate_names: bool = False)[source]
Add an object to the collection
- Parameters:
ref – The reference to the object.
save – If this is true then the objet is persisted on the disk.
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.
with_sync – If a sync should be triggered when the object is renamed.
with_triggers – If triggers should be run when the object is added.
quick_pxe_update – This decides if there should be run a quick or full update after the add was done.
check_for_duplicate_names – If the name of an object should be unique or not.
- Raises:
TypError – Raised in case
ref
is None.ValueError – Raised in case the name of
ref
is empty.
- static collection_type() str [source]
Returns the string key for the name of the collection (used by serializer etc)
- static collection_types() str [source]
Returns the string key for the plural name of the collection (used by serializer)
- copy(ref, newname)[source]
Copy an object with a new name into the same collection.
- Parameters:
ref – The reference to the object which should be copied.
newname – The new name for the copied object.
- factory_produce(api, seed_data)[source]
Must override in subclass. Factory_produce returns an Item object from dict.
- Parameters:
api – The API to resolve all information with.
seed_data – Unused Parameter in the base collection.
- find(name: str = '', return_list: bool = False, no_errors=False, **kargs: dict) List[Item] | Item | None [source]
Return first object in the collection that matches 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.
- Parameters:
name – The object name which should be found.
return_list – If a list should be returned or the first match.
no_errors – If errors which are possibly thrown while searching should be ignored or not.
kargs – If name is present, this is optional, otherwise this dict needs to have at least a key with
name
. You may specify more keys to finetune the search.
- Returns:
The first item or a list with all matches.
- Raises:
ValueError – In case no arguments for searching were specified.
- from_list(_list: list)[source]
Create all collection object items from
_list
.- Parameters:
_list – The list with all item dictionaries.
- get(name: str)[source]
Return object with name in the collection
- Parameters:
name – The name of the object to retrieve from the collection.
- Returns:
The object if it exists. Otherwise None.
- remove(name: str, with_delete: bool = True, with_sync: bool = True, with_triggers: bool = True, recursive: bool = False)[source]
Remove an item from collection. This method must be overridden in any subclass.
- Parameters:
name – Item Name
with_delete – sync and run triggers
with_sync – sync to server file system
with_triggers – run “on delete” triggers
recursive – recursively delete children
- Returns:
NotImplementedError
- rename(ref: Item, newname, with_sync: bool = True, with_triggers: bool = True)[source]
Allows an object “ref” to be given a new name without affecting the rest of the object tree.
- Parameters:
ref – The reference to the object which should be renamed.
newname – The new name for the object.
with_sync – If a sync should be triggered when the object is renamed.
with_triggers – If triggers should be run when the object is renamed.
9.1.2.3. cobbler.cobbler_collections.distros 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.cobbler_collections.distros.Distros(collection_mgr)[source]
Bases:
Collection
A distro represents a network bootable matched set of kernels and initrd files.
- static collection_type() str [source]
Returns the string key for the name of the collection (used by serializer etc)
- static collection_types() str [source]
Returns the string key for the plural name of the collection (used by serializer)
- remove(name, with_delete: bool = True, with_sync: bool = True, with_triggers: bool = True, recursive: bool = False)[source]
Remove element named ‘name’ from the collection
- Raises:
CX – In case any subitem (profiles or systems) would be orphaned. If the option
recursive
is set then the orphaned items would be removed automatically.
9.1.2.4. 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:
Collection
Files provide a container for file resources.
- static collection_type() str [source]
Returns the string key for the name of the collection (used by serializer etc)
9.1.2.5. cobbler.cobbler_collections.images 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.cobbler_collections.images.Images(collection_mgr)[source]
Bases:
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.
- static collection_type() str [source]
Returns the string key for the name of the collection (used by serializer etc)
9.1.2.6. cobbler.cobbler_collections.manager module
Repository of the Cobbler object model
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.cobbler_collections.manager.CollectionManager(api)[source]
Bases:
object
Manages a definitive copy of all data cobbler_collections with weakrefs pointing back into the class so they can understand each other’s contents.
- deserialize()[source]
Load all cobbler_collections from disk
- Raises:
CX – if there is an error in deserialization
- get_items(collection_type: str) Distros | Profiles | Systems | Repos | Images | Mgmtclasses | Packages | Files | Menus [source]
Get a full collection of a single type.
Valid Values vor
collection_type
are: “distro”, “profile”, “repo”, “image”, “mgmtclass”, “package”, “file” and “settings”.- Parameters:
collection_type – The type of collection to return.
- Returns:
The collection if
collection_type
is valid.- Raises:
CX – If the
collection_type
is invalid.
- has_loaded = False
Return the definitive copy of the Menus collection
- mgmtclasses() Mgmtclasses [source]
Return the definitive copy of the Mgmtclasses collection
- serialize_delete(collection, item)[source]
Delete a collection item from disk
- Parameters:
collection – collection
item – collection item
- serialize_delete_one_item(item)[source]
Save a collection item to disk
- Parameters:
item – collection item
9.1.2.8. cobbler.cobbler_collections.mgmtclasses 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.mgmtclasses.Mgmtclasses(collection_mgr)[source]
Bases:
Collection
A mgmtclass provides a container for management resources.
- static collection_type() str [source]
Returns the string key for the name of the collection (used by serializer etc)
- static collection_types() str [source]
Returns the string key for the plural name of the collection (used by serializer)
9.1.2.9. cobbler.cobbler_collections.packages 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.packages.Packages(collection_mgr)[source]
Bases:
Collection
A package provides a container for package resources.
- static collection_type() str [source]
Returns the string key for the name of the collection (used by serializer etc)
9.1.2.10. cobbler.cobbler_collections.profiles 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.cobbler_collections.profiles.Profiles(collection_mgr)[source]
Bases:
Collection
A profile represents a distro paired with an automatic OS installation template file.
- static collection_type() str [source]
Returns the string key for the name of the collection (used by serializer etc)
9.1.2.11. cobbler.cobbler_collections.repos 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.cobbler_collections.repos.Repos(collection_mgr)[source]
Bases:
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.
- static collection_type() str [source]
Returns the string key for the name of the collection (used by serializer etc)
9.1.2.12. cobbler.cobbler_collections.systems module
Copyright 2008-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.cobbler_collections.systems.Systems(collection_mgr)[source]
Bases:
Collection
Systems are hostnames/MACs/IP names and the associated profile they belong to.
- static collection_type() str [source]
Returns the string key for the name of the collection (used by serializer etc)
- static collection_types() str [source]
Returns the string key for the plural name of the collection (used by serializer)
9.1.2.13. Module contents
The collections have the responsibility of ensuring the relational validity of the data present in Cobbler. Further they hold the data at runtime.