Example #1
0
def init_db():
    from reddwarf.common import cfg
    from reddwarf.db import get_db_api
    from reddwarf.db.sqlalchemy import session
    CONF = cfg.CONF
    db_api = get_db_api()
    db_api.db_sync(CONF)
    session.configure_db(CONF)
Example #2
0
def initialize_database():
    from reddwarf.db import get_db_api
    from reddwarf.instance import models
    from reddwarf.db.sqlalchemy import session
    db_api = get_db_api()
    db_api.drop_db(CONF)  # Destroys the database, if it exists.
    db_api.db_sync(CONF)
    session.configure_db(CONF)
    # Adds the image for mysql (needed to make most calls work).
    models.ServiceImage.create(service_name="mysql", image_id="fake")
    db_api.configure_db(CONF)
Example #3
0
def configure_db(options, *plugins):
    session.configure_db(options)
    configure_db_for_plugins(options, *plugins)
Example #4
0
def configure_db_for_plugins(options, *plugins):
    for plugin in plugins:
        session.configure_db(options, models_mapper=plugin.mapper)
Example #5
0
def configure_db(options, *plugins):
    session.configure_db(options)
    configure_db_for_plugins(options, *plugins)
Example #6
0
def configure_db_for_plugins(options, *plugins):
    for plugin in plugins:
        session.configure_db(options, models_mapper=plugin.mapper)
Example #7
0
def configure_db_for_plugins(options, *plugins):
    LOG.debug("Configuring DB with options: %s" % options)
    if plugins:
        LOG.debug("Configuring DB with plugins: %s" % plugins)
    for plugin in plugins:
        session.configure_db(options, models_mapper=plugin.mapper)