How to use the formulas.models.Formula.objects function in formulas

To help you get started, we’ve selected a few formulas examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github stackdio / stackdio / stackdio / formulas / tasks.py View on Github external
@celery.task(name='formulas.import_formula')  # NOQA
def import_formula(formula_id, git_password):
    try:
        formula = Formula.objects.get(pk=formula_id)
        formula.set_status(Formula.IMPORTING, 'Cloning and importing formula.')

        repodir = clone_to_temp(formula, git_password)

        root_dir = formula.get_repo_dir()

        if os.path.isdir(root_dir):
            raise FormulaTaskException(
                formula,
                'Formula root path already exists.')

        formula_title, formula_description, root_path, components = validate_specfile(formula, repodir)

        # update the formula title and description
        formula.title = formula_title
        formula.description = formula_description