8.1.4.1.5. cobbler.modules.serializers package
8.1.4.1.5.1. Submodules
8.1.4.1.5.2. cobbler.modules.serializers.file module
Cobbler’s file-based object serializer. As of 9/2014, this is Cobbler’s default serializer and the most stable one. It uses multiple JSON files in /var/lib/cobbler/collections/distros, profiles, etc
- class cobbler.modules.serializers.file.FileSerializer(api: CobblerAPI)[source]
Bases:
StorageBase
TODO
- deserialize(collection: Collection[ITEM], topological: bool = True) None [source]
Load a collection from the database.
- Parameters
collection – The collection to deserialize.
topological – If the collection list should be sorted by the collection dict depth value or not.
- deserialize_item(collection_type: str, name: str) Dict[str, Any] [source]
Get a collection item from disk and parse it into an object.
- Parameters
collection_type – The collection type to fetch.
name – collection Item name
- Returns
Dictionary of the collection item.
- deserialize_raw(collection_type: str) List[Dict[str, Any]] [source]
Get a collection from mongodb and parse it into an object.
- Parameters
collection_type – The collection type to fetch.
- Returns
The first element of the collection requested.
- serialize(collection: Collection[ITEM]) None [source]
Save a collection to database
- Parameters
collection – collection
- serialize_delete(collection: Collection[ITEM], item: ITEM) None [source]
Delete a collection item from database.
- Parameters
collection – collection
item – collection item
- serialize_item(collection: Collection[ITEM], item: ITEM) None [source]
Save a collection item to database.
- Parameters
collection – collection
item – collection item
- cobbler.modules.serializers.file.register() str [source]
The mandatory Cobbler module registration hook.
- cobbler.modules.serializers.file.storage_factory(api: CobblerAPI) FileSerializer [source]
TODO
8.1.4.1.5.3. cobbler.modules.serializers.mongodb module
Cobbler’s Mongo database based object serializer.
- class cobbler.modules.serializers.mongodb.MongoDBSerializer(api: CobblerAPI)[source]
Bases:
StorageBase
TODO
- deserialize(collection: Collection[ITEM], topological: bool = True)[source]
Load a collection from the database.
- Parameters
collection – The collection to deserialize.
topological – If the collection list should be sorted by the collection dict depth value or not.
- deserialize_item(collection_type: str, name: str) Dict[str, Any] [source]
Get a collection item from database.
- Parameters
collection_type – The collection type to fetch.
name – collection Item name
- Returns
Dictionary of the collection item.
- deserialize_raw(collection_type: str) List[Dict[str, Any]] [source]
Get a collection from mongodb and parse it into an object.
- Parameters
collection_type – The collection type to fetch.
- Returns
The first element of the collection requested.
- serialize(collection: Collection[ITEM]) None [source]
Save a collection to database
- Parameters
collection – collection
- serialize_delete(collection: Collection[ITEM], item: ITEM) None [source]
Delete a collection item from database.
- Parameters
collection – collection
item – collection item
- serialize_item(collection: Collection[ITEM], item: ITEM) None [source]
Save a collection item to database.
- Parameters
collection – collection
item – collection item
- cobbler.modules.serializers.mongodb.register() str [source]
The mandatory Cobbler module registration hook.
- cobbler.modules.serializers.mongodb.storage_factory(api: CobblerAPI) MongoDBSerializer [source]
TODO
8.1.4.1.5.4. Module contents
This module contains code to persist the in memory state of Cobbler on a target. The name of the target should be the name of the Python file. Cobbler is currently only tested against the file serializer.
- class cobbler.modules.serializers.StorageBase(api: CobblerAPI)[source]
Bases:
object
TODO
- deserialize(collection: Collection[ITEM], topological: bool = True) None [source]
Load a collection from the database.
- Parameters
collection – The collection to deserialize.
topological – If the collection list should be sorted by the collection dict depth value or not.
- deserialize_item(collection_type: str, name: str) Dict[str, Any] [source]
Get a collection item from database and parse it into an object.
- Parameters
collection_type – The collection type to fetch.
item – collection item
topological – If the collection list should be sorted by the collection dict depth value or not.
- Returns
The first element of the collection requested.
- deserialize_raw(collection_type: str) List[Dict[str, Any]] [source]
Get a collection from mongodb and parse it into an object.
- Parameters
collection_type – The collection type to fetch.
- Returns
The first element of the collection requested.
- serialize(collection: Collection[ITEM]) None [source]
Save a collection to database
- Parameters
collection – collection
- serialize_delete(collection: Collection[ITEM], item: ITEM) None [source]
Delete a collection item from database.
- Parameters
collection – collection
item – collection item
- serialize_item(collection: Collection[ITEM], item: ITEM) None [source]
Save a collection item to database.
- Parameters
collection – collection
item – collection item
- cobbler.modules.serializers.storage_factory(api: CobblerAPI) StorageBase [source]
TODO