Example #1
0
def get_install_task_flavor(job_config):
    """
    Pokes through the install task's configuration (including its overrides) to
    figure out which flavor it will want to install.

    Only looks at the first instance of the install task in job_config.
    """
    project, = job_config.get('project', 'ceph'),
    tasks = job_config.get('tasks', dict())
    overrides = job_config.get('overrides', dict())
    install_overrides = overrides.get('install', dict())
    project_overrides = install_overrides.get(project, dict())
    first_install_config = dict()
    for task in tasks:
        if list(task.keys())[0] == 'install':
            first_install_config = list(task.values())[0] or dict()
            break
    first_install_config = copy.deepcopy(first_install_config)
    deep_merge(first_install_config, install_overrides)
    deep_merge(first_install_config, project_overrides)
    return get_flavor(first_install_config)
Example #2
0
 def test_get_flavor_simple(self):
     config = dict(
         flavor='notcmalloc'
     )
     assert install.get_flavor(config) == 'notcmalloc'
Example #3
0
 def test_get_flavor_valgrind(self):
     config = dict(
         valgrind=True
     )
     assert install.get_flavor(config) == 'notcmalloc'
Example #4
0
 def test_get_flavor_default(self):
     config = dict()
     assert install.get_flavor(config) == 'basic'