Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@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