

def validate_component(formula, repodir, component):
    from .tasks import FormulaTaskException
    if (('title' not in component) or ('sls_path' not in component)):
        raise FormulaTaskException(formula, "Each component in the SPECFILE must contain a 'title' and 'sls_path' field.")
    component_title = component['title']
    sls_path = component['sls_path'].replace('.', '/')
    init_file = os.path.join(sls_path, 'init.sls')
    sls_file = (sls_path + '.sls')
    abs_init_file = os.path.join(init_file, init_file)
    abs_sls_file = os.path.join(repodir, sls_file)
    if ((not os.path.isfile(abs_init_file)) and (not os.path.isfile(abs_sls_file))):
        raise FormulaTaskException(formula, "Could not locate an SLS file for component '{0}'. Expected to find either '{1}' or '{2}'.".format(component_title, init_file, sls_file))

dataset/ETHPy150Open stackdio/stackdio/stackdio/api/formulas/validators.py validate_component/VarMisuse@98/180 `repodir`->`init_file`