

def validate_formula_component(component, versions=()):
    '\n    Validate a SINGLE formula component from versions that already exist.\n    i.e. adding a formula component to a blueprint or cloud account\n    '
    version_map = {
        
    }
    for version in versions:
        version_map[version.formula] = version.version
    errors = {
        
    }
    formula = component.get('formula')
    sls_path = component['sls_path']
    version = version_map.get(formula, formula.default_version)
    component_list = formula.components_for_version(version)
    if (sls_path not in component_list):
        err_msg = 'formula `{0}` does not contain an sls_path called `{1}`.'
        errors.setdefault('sls_path', []).append(err_msg.format(formula.uri, sls_path))
    if errors:
        raise ValidationError(errors)
    return component

dataset/ETHPy150Open stackdio/stackdio/stackdio/api/formulas/validators.py validate_formula_component/original