Beispiel #1
0
def dump_master_node_settings(connection, fixture_path=None):
    """Generate uuid for master node installation and update
    master_node_settings table by generated value

    Arguments:
    connection - a database connection
    """

    if not fixture_path:
        fixture_path = os.path.join(os.path.dirname(__file__), '..',
                                    'fixtures', 'master_node_settings.yaml')

    with open(fixture_path, 'r') as fixture_file:
        fixt = load_fixture(fixture_file, loader=yaml)

    settings = json.dumps(fixt[0]["fields"]["settings"])

    generated_uuid = str(uuid.uuid4())

    insert_query = text(
        "INSERT INTO master_node_settings (master_node_uid, settings) "
        "   VALUES (:master_node_uid, :settings)")

    connection.execute(insert_query,
                       master_node_uid=generated_uuid,
                       settings=settings)
Beispiel #2
0
def dump_master_node_settings(connection, fixture_path=None):
    """Generate uuid for master node installation and update
    master_node_settings table by generated value

    Arguments:
    connection - a database connection
    """

    if not fixture_path:
        fixture_path = os.path.join(os.path.dirname(__file__), '..',
                                    'fixtures', 'master_node_settings.yaml')

    with open(fixture_path, 'r') as fixture_file:
        fixt = load_fixture(fixture_file, loader=yaml)

    settings = json.dumps(fixt[0]["fields"]["settings"])

    generated_uuid = str(uuid.uuid4())

    insert_query = text(
        "INSERT INTO master_node_settings (master_node_uid, settings) "
        "   VALUES (:master_node_uid, :settings)"
    )

    connection.execute(insert_query, master_node_uid=generated_uuid,
                       settings=settings)
Beispiel #3
0
 def read_fixtures(self, fxtr_names):
     data = []
     for fxtr_path in self.fxtr_paths_by_names(fxtr_names):
         with open(fxtr_path, "r") as fxtr_file:
             try:
                 data.extend(load_fixture(fxtr_file))
             except Exception as exc:
                 logger.error('Error "%s" occurred while loading ' "fixture %s" % (exc, fxtr_path))
     return data
Beispiel #4
0
 def read_fixtures(self, fxtr_names):
     data = []
     for fxtr_path in self.fxtr_paths_by_names(fxtr_names):
         with open(fxtr_path, "r") as fxtr_file:
             try:
                 data.extend(load_fixture(fxtr_file))
             except Exception as exc:
                 logger.error('Error "%s" occurred while loading '
                              'fixture %s' % (exc, fxtr_path))
     return data
Beispiel #5
0
def upgrade_release_wizard_metadata_50_to_51(fixture_path=None):
    if not fixture_path:
        fixture_path = os.path.join(os.path.dirname(__file__), '..',
                                    'fixtures', 'openstack.yaml')

    with open(fixture_path, 'r') as fixture_file:
        fixt = load_fixture(fixture_file, loader=yaml)

    # wizard_meta is the same for all existing in db releases
    wizard_meta = fixt[0]['fields']['wizard_metadata']
    # remove nsx data from Network section of wizard_metadata
    wizard_meta['Network']['manager']['values'] = [
        n for n in wizard_meta['Network']['manager']['values']
        if n['data'] != 'neutron-nsx'
    ]

    return wizard_meta
Beispiel #6
0
def upgrade_release_wizard_metadata_50_to_51(fixture_path=None):
    if not fixture_path:
        fixture_path = os.path.join(os.path.dirname(__file__), '..',
                                    'fixtures', 'openstack.yaml')

    with open(fixture_path, 'r') as fixture_file:
        fixt = load_fixture(fixture_file, loader=yaml)

    # wizard_meta is the same for all existing in db releases
    wizard_meta = fixt[0]['fields']['wizard_metadata']
    # remove nsx data from Network section of wizard_metadata
    wizard_meta['Network']['manager']['values'] = [
        n for n in wizard_meta['Network']['manager']['values']
        if n['data'] != 'neutron-nsx'
    ]

    return wizard_meta