9.1.4.1.5. cobbler.modules.serializers package

9.1.4.1.5.1. Submodules

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

cobbler.modules.serializers.file.deserialize(collection, topological: bool = True)[source]

Load a collection from file system.

Parameters
  • collection – The collection to deserialize.

  • topological – If the collection list should be sorted by the collection dict key ‘depth’ value or not.

cobbler.modules.serializers.file.deserialize_raw(collection_types: str)[source]

Loads a collection from the disk.

Parameters

collection_types – The type of collection to load.

Returns

The loaded dictionary.

cobbler.modules.serializers.file.register() str[source]

The mandatory Cobbler module registration hook.

cobbler.modules.serializers.file.serialize(collection)[source]

Save a collection to file system

Parameters

collection – collection

cobbler.modules.serializers.file.serialize_delete(collection, item)[source]

Delete a collection item from file system.

Parameters
  • collection – collection

  • item – collection item

cobbler.modules.serializers.file.serialize_item(collection, item)[source]

Save a collection item to file system

Parameters
  • collection – collection

  • item – collection item

cobbler.modules.serializers.file.what() str[source]

Module identification function

9.1.4.1.5.3. cobbler.modules.serializers.mongodb module

Cobbler’s Mongo database based object serializer. Experimental version.

cobbler.modules.serializers.mongodb.deserialize(collection, 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.

cobbler.modules.serializers.mongodb.deserialize_raw(collection_type: str)[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.

cobbler.modules.serializers.mongodb.register() str[source]

The mandatory Cobbler module registration hook.

cobbler.modules.serializers.mongodb.serialize(collection)[source]

Save a collection to database

Parameters

collection – collection

cobbler.modules.serializers.mongodb.serialize_delete(collection, item)[source]

Delete a collection item from database.

Parameters
  • collection – collection

  • item – collection item

cobbler.modules.serializers.mongodb.serialize_item(collection, item)[source]

Save a collection item to database.

Parameters
  • collection – collection

  • item – collection item

cobbler.modules.serializers.mongodb.what() str[source]

Module identification function

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