Orchestrator API

dispatcher Package

«  API V.1   ::   Contents   ::   components Package  »

dispatcher Package

dispatcher Package

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

Dispatcher initialization script.

Dispatcher is the core of the Orchestrator, it provides a RESTful API web service with a JSON dialect.

The initialization script is not supposed to be used directly or imported.

In addiction to switch between development or production config file set proporly the variable:

>>> DEV = True  # Debug on
>>> DEV = False # Debug off
dispatcher.__init__.configure_app(app)[source]

setup the flask application using setting directives.

there are 3 ways to properly configure the flask app:

  • changing settings.py content
  • using the environmental variable MIDDLEWARE_SETTINGS
  • using a custom python file settings_local.cfg
dispatcher.__init__.create_app()[source]

Used to create a configured flask application

dispatcher.__init__.setup_logging(app)[source]

setup logging facilities on setting directives

scripts Module

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

Scripts file, used within flask-script routines to initialize the Orchestrator environment

class dispatcher.scripts.PopulateDB[source]

Bases: flask_script.commands.Command

Fills in predefined data into DB

run(**kwargs)[source]

Run populate routine

class dispatcher.scripts.ResetDB[source]

Bases: flask_script.commands.Command

Drops all tables and recreates them

run(**kwargs)[source]

Run reset routine

settings Module

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

Description

Settings file, used to configure the main Flask app.

This configuration provides three classes:

  • Config defines attributes for a global behaviour
  • ProductionConfig defines and set attributes to use only in a stable environment ( like a loggin level not pushed to extreme )
  • DevelopmentConfig defines and set attrs only for a dev environment

There is also another class, CloudConfig contains credentials and url of the favorite cloud providers

class dispatcher.settings.CloudConfig[source]

Bases: object

CLOUD_FARM = {'default': {'ENGINE': 'openstack', 'PASSWORD': 'secrete', 'USER': 'admin', 'EXTRA_PARAMS': {'ex_force_auth_version': '2.0_password', 'ex_tenant_name': 'demo', 'ex_force_auth_url': 'http://openstack.crs4.it:5000/v2.0'}}, 'eucalyptus': {'ENGINE': 'eucalyptus', 'PASSWORD': 'SlHFB5isHdqAAwMtTZT4fSB1KKeuAclcwIbgSZIv', 'USER': 'AKIMONBMNDMODZKP4SIX', 'EXTRA_PARAMS': {'path': '/services/Eucalyptus', 'host': 'eucalyptus.ecc.eucalyptus.com', 'secret': 'SlHFB5isHdqAAwMtTZT4fSB1KKeuAclcwIbgSZIv', 'secure': False, 'port': 8773}}, 'fake_driver': {'ENGINE': 'dummy'}}
class dispatcher.settings.Config[source]

Bases: object

Main configuration class, is intended to be used as a base class to inheritate

CISTERN_API = 'v1'
CISTERN_HOST = '127.0.0.1'
CISTERN_PORT = 5051
HOST = '0.0.0.0'
LOG_FILE = '/tmp/middleware.log'
LOG_LEVEL = 10
PORT = 5050
SECRET_KEY = 'dev key pass foobar 1 2 3'
SECURITY_REGISTERABLE = False
SECURITY_TOKEN_AUTHENTICATION_HEADER = 'X-Auth-Token'
SECURITY_TOKEN_AUTHENTICATION_KEY = 'auth_token'
SECURITY_URL_PREFIX = '/api/v1/auth'
SQLALCHEMY_DATABASE_URI = 'sqlite:////tmp/auth.db'
class dispatcher.settings.DevelopmentConfig[source]

Bases: dispatcher.settings.Config

Development settings

DEBUG = True
LOG_FILE = '/tmp/middleware_dev.log'
LOG_LEVEL = 10
TESTING = True
class dispatcher.settings.ProductionConfig[source]

Bases: dispatcher.settings.Config

Production settings

DEBUG = False
LOG_LEVEL = 20
TESTING = False

views Module

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

View file, used to register blueprints/api versions

dispatcher.views.index()[source]
dispatcher.views.page_not_found(e)[source]

«  API V.1   ::   Contents   ::   components Package  »