Esempio n. 1
0
def get_engine(url=None):
    global A10_CFG

    if url is None:
        if A10_CFG is None:
            A10_CFG = a10_config.A10Config()

        url = A10_CFG.get('database_connection')

    return sqlalchemy.create_engine(url)
Esempio n. 2
0
    def execute(self, amphora, loadbalancer):
        vthunder_id = uuidutils.generate_uuid()
        a10_conf = a10_config.A10Config()
        self.config = a10_conf.get_conf()

        username = self.config.get('DEFAULT',
                                   'DEFAULT_VTHUNDER_USERNAME').replace(
                                       '"', '')
        password = self.config.get('DEFAULT',
                                   'DEFAULT_VTHUNDER_PASSWORD').replace(
                                       '"', '')

        axapi_version = int(self.config.get('DEFAULT',
                                            'DEFAULT_AXAPI_VERSION'))

        compute_id = None
        undercloud = True
        if amphora.compute_id:
            compute_id = amphora.compute_id
            undercloud = False
        else:
            undercloud = None
            undercloud = True
        vthunder = self.vthunder_repo.create(
            db_apis.get_session(),
            vthunder_id=vthunder_id,
            amphora_id=amphora.id,
            device_name=vthunder_id,
            username=username,
            password=password,
            ip_address=amphora.lb_network_ip,
            undercloud=False,
            axapi_version=axapi_version,
            loadbalancer_id=loadbalancer.id,
            project_id=loadbalancer.project_id,
            compute_id=compute_id)
        LOG.info("Successfully created vthunder entry in database.")
Esempio n. 3
0
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config

# Interpret the config file for Python logging.
# This line sets up loggers basically.
fileConfig(config.config_file_name)

# add your model's MetaData object here
# for 'autogenerate' support
# from myapp import mymodel
# target_metadata = mymodel.Base.metadata
target_metadata = None

if getattr(config, 'connection', None) is None:
    a10_cfg = a10_config.A10Config()
    config.set_main_option("sqlalchemy.url",
                           a10_cfg.get('database_connection'))

# other values from the config, defined by the needs of env.py,
# can be acquired:
# my_important_option = config.get_main_option("my_important_option")
# ... etc.


def run_migrations_offline():
    """Run migrations in 'offline' mode.

    This configures the context with just a URL
    and not an Engine, though an Engine is acceptable
    here as well.  By skipping the Engine creation
Esempio n. 4
0
 def __init__(self, **kwargs):
     a10_conf = a10_config.A10Config()
     self.config = a10_conf.get_conf()
     self.task_utils = task_utilities.TaskUtils()
     super(BaseVThunderTask, self).__init__(**kwargs)