Ejemplo n.º 1
0
def config():
    """Get the global config options from oslo.config INI file"""
    config_files = []

    tests_configs = os.environ.get('TESTS_CONFIGS', None)
    if tests_configs:
        for test_config in tests_configs.split(','):
            config_files.append(test_config)

    LOG.info("\n" + "-" * 10 + " Initialize oslo.config variables with "
             "defaults from environment" + "-" * 10)
    config_opts = settings_oslo.load_config(config_files)

    if os.path.isfile(config_opts.underlay.ssh_key_file):
        LOG.debug('Loading SSH key from file: {0}'.format(
            config_opts.underlay.ssh_key_file))
        key_from_file = utils.load_keyfile(config_opts.underlay.ssh_key_file)
        if key_from_file not in config_opts.underlay.ssh_keys:
            config_opts.underlay.ssh_keys.append(key_from_file)
    else:
        if not config_opts.underlay.ssh_keys:
            config_opts.underlay.ssh_keys.append(utils.generate_keys())
        utils.dump_keyfile(config_opts.underlay.ssh_key_file,
                           config_opts.underlay.ssh_keys[0])
        LOG.debug('Saving SSH key to file: {0}'.format(
            config_opts.underlay.ssh_key_file))
        utils.dump_keyfile(config_opts.underlay.ssh_key_file,
                           config_opts.underlay.ssh_keys[0])

    return config_opts
Ejemplo n.º 2
0
def config():
    """Get the global config options from oslo.config INI file"""
    config_files = []

    tests_configs = os.environ.get('TESTS_CONFIGS', None)
    if tests_configs:
        for test_config in tests_configs.split(','):
            config_files.append(test_config)

    config_opts = settings_oslo.load_config(config_files)

    return config_opts
Ejemplo n.º 3
0
def config():

    config_files = []

    tests_configs = os.environ.get('TESTS_CONFIGS', None)
    if tests_configs:
        for test_config in tests_configs.split(','):
            config_files.append(test_config)

    config_opts = settings_oslo.load_config(config_files)

    return config_opts
Ejemplo n.º 4
0
import pytest
import mock
import os

from tcp_tests.helpers import env_config
from tcp_tests import settings_oslo

config = settings_oslo.load_config(config_files=[])
config.underlay.ssh = [{
    "node_name": "cfg01.cookied-dop-sl2.local",
    "host": "10.70.0.15"
}, {
    "node_name": "cid01.cookied-dop-sl2.local",
    "host": "10.70.0.91"
}, {
    "node_name": "cid02.cookied-dop-sl2.local",
    "host": "10.70.0.92"
}, {
    "node_name": "cid03.cookied-dop-sl2.local",
    "host": "10.70.0.93"
}, {
    "node_name": "ctl01.cookied-dop-sl2.local",
    "host": "10.70.0.11"
}, {
    "node_name": "ctl02.cookied-dop-sl2.local",
    "host": "10.70.0.12"
}, {
    "node_name": "ctl03.cookied-dop-sl2.local",
    "host": "10.70.0.13"
}, {
    "node_name": "mon01.cookied-dop-sl2.local",
Ejemplo n.º 5
0
          "  export LAB_CONFIG_NAME=cookied-cicd-...  "
          "# see directories in tcp_tests/templates/\n"
          "  export LAB_PARAM_DEFAULTS=nnnn.env "
          "# see files in tcp_tests/templates/_heat_environments")
    sys.exit(1)

sys.path.append(os.getcwd())
try:
    from tcp_tests import settings_oslo
except ImportError:
    print("ImportError: Run the application from the tcp-qa directory or "
          "set the PYTHONPATH environment variable to directory which contains"
          " ./tcp_tests")
    sys.exit(1)

config = settings_oslo.load_config([])

template_file = config.hardware.heat_conf_path
env_file = config.hardware.heat_env_path

if not os.path.exists(template_file):
    raise Exception(
        "Heat template '{0}' not found!\n"
        "Please set the correct LAB_CONFIG_NAME with underlay.hot".format(
            template_file))

tpl_files, template = template_utils.get_template_contents(template_file)

if os.path.exists(env_file):
    env_files_list = []
    env_files, env = (template_utils.process_multiple_environments_and_files(