module Cobbler
Base
represents a type of item on the Cobbler
server.
Child classes can define fields that will be retrieved from Cobbler
by using the cobbler_field
method. For example:
class System < Base cobbler_lifecycle :find_all => 'get_systems' cobbler_field :name cobbler_collection :owners, :type => 'String', :packing => :hash end
declares a class named System
that contains two fields and a class-level method.
The first field, “name”, is a simple property. It will be retrieved from the value “name” in the remote definition for a system, identifyed by the :owner
argument.
The second field, “owners”, is similarly retrieved from a property also named “owners” in the remote definition. However, this property is a collection: in this case, it is an array of definitions itself. The :type
argument identifies what the local
class type is that will be used to represent each element in the collection.
A cobbler_collection
is packed in one of two ways: either as an array of values or as a hash of keys and associated values. These are defined by the :packing
argument with the values Array
and Hash
, respectively.
The cobbler_lifecycle
method allows for declaring different methods for retrieving remote instances of the class. cobbler_lifecycle
also declares automatically the various API methods if they aren’t overwritten. These methods are (defaults are shown for an item called Model):
find_one
- to find a single instance (get_model) find_all
- to find all instances (get_models) remove
- to remove an instance (remove_model) handle
- to obtain the handle for this item (get_model_handle) save
- to store an item (save_model) new
- to create a new item (new_model) modify
- to modify an existing model (modfiy_model)
Debug
provides a basic debugging infrastructure.
Finders
provides the basic 2 finder methods to query a cobbler server
find_one
to fetch exactly one item based on its name find
to find all items, takes a block to work with the fetched items
Lifecycle
implements a default set of functionality that a cobbler item can have. Usually the Lifecycle
methods are used to define query functions and define which fields of a cobbler item is exposed through the api.
Common
provides common methods of the cobbler server exposed through the api.
Handling
provides common methods to handle the xmlrpc connection to the cobbler server
Distro
represents a single distrobution within Cobbler
.
Image
represents an image within Cobbler
.
Profile
represents a single profile within Cobbler
.
Repo
represents a single repository within Cobbler
.
System
represents a system within Cobbler
.
Constants
- VERSION