Orchestrator API

lib Package

«  components Package   ::   Contents   ::   cloud_factory Package  »

lib Package

lib Package

class dispatcher.lib.Provider[source]

Bases: object

Defines for each of the supported providers

DUMMY = 'dummy'
EC2_EU_EAST = 'ec2_eu_east'
EC2_EU_WEST = 'ec2_eu_west'
EC2_US_EAST = 'ec2_us_east'
EC2_US_WEST = 'ec2_us_west'
EUCALYPTUS = 'eucalyptus'
OPENSTACK = 'openstack'
RACKSPACE = 'rackspace'

cloud_init Module

copyright:© 2015 by CRS4.
license:gpl-2, see License for more details.

cloud initialization script.

..WARNING::
it’s not supposed to be used directly nor imported.
class dispatcher.lib.cloud_init.CloudPool[source]

Bases: object

Handle the application cloud pool.

ToDo:

It is likely this is the best place to implement a route over clouds so this could be the best place where to implement it.

add_driver(name, driver, data)[source]

Add a driver in the pool

hard_refresh(pool)[source]
refresh_driver(settings=None, name='None', soft_refresh=True)[source]
remove_driver(name)[source]

Remove a driver from the pool

soft_refresh(name)[source]
class dispatcher.lib.cloud_init.DriverNode(name, driver, data)[source]

Bases: object

Single cloud driver

dispatcher.lib.cloud_init.load_environment(pool)[source]

Read from configuration and load

dispatcher.lib.cloud_init.prepare_cloud_environment(pool)[source]

Initialize and prepare cloud pool

dispatcher.lib.cloud_init.prepare_pool_dict(data)[source]

support routine

constants Module

copyright:© 2015 by CRS4.
license:gpl-2, see License for more details.

Various constants definition

class dispatcher.lib.constants.Const[source]

Bases: object

Abstract class used in a confort

ERROR = 'error'
MAX_ITERATIONS = 3
OK = 'ok'
action_not_valid = 'Unrecognized action found'
cloud_not_valid = 'Cloud not valid'
cloud_or_invalid_path = 'Cloud not valid or wrong path'
create_node = 'create_node'
destroy_node = 'destroy_node'
list_images = 'list_images'
list_nodes = 'list_nodes'
list_sizes = 'list_sizes'
not_implemented = 'Not implemented'

helpers Module

copyright:© 2015 by CRS4.
license:gpl-2, see License for more details.

Various helpers, custom exceptions, login mechanism and wrappers

class dispatcher.lib.helpers.HTTPConnection(server, port, api_version, headers=None)[source]

Bases: object

Class to make connections and deal with web services

get_page(url, method='get', payload=None)[source]

Make a generic call with a json response

  • url is the relative url to contact, protocol and servername is added on the fly with what has been specified on initialization of the object

  • kwargs is an attribute of optional key/value pairs, should be:
    • method, the way to contact the server, default is ‘get’,
    • payload, is a dictionary structure containing additional payload useful to the request
exception dispatcher.lib.helpers.MiddlewareException(message, format='json', state='success', code=200, url=None)[source]

Bases: werkzeug.exceptions.HTTPException

Cancel abortion of the current task and return with the given message and error code.

get_response(environ)[source]
dispatcher.lib.helpers.auth_required(*auth_methods)[source]

Adaptation for security.decorators.auth_required

dispatcher.lib.helpers.get_a_caller(app_context)[source]

With an app_context ( to access the settings data ) this routines will spawn a caller object to make HTTP calls. Settings are CISTERN_* data

dispatcher.lib.helpers.make_response(status=None, status_code=200, other_headers=None, **kwargs)[source]

Return a suitable HTML or JSON error message response.

dispatcher.lib.helpers.not_implemented()[source]

Quick function to reply with a Not implemented response

dispatcher.lib.helpers.validate_json(validate_function, default=None)[source]

Decorator to validate and marshal the incoming JSON.

Sets request.json to the value returned from calling validate_function on request.json (or default() if request.json is None). If this raises an exception then the call stack is terminated early with a MiddlewareException() exception

If request.json is None then default() is used. Note that
  1. default is a callable which must create the default value (to avoid accidental re-use of mutables)
  2. the result is still passed through the validate_function (to ensure the invariant holds)

«  components Package   ::   Contents   ::   cloud_factory Package  »