diff --git a/src/pylorax/api/recipes.py b/src/pylorax/api/recipes.py index 746c7cdc..65885f90 100644 --- a/src/pylorax/api/recipes.py +++ b/src/pylorax/api/recipes.py @@ -343,6 +343,21 @@ def list_commit_files(repo, commit): tree = commit_obj.get_tree() return sorted([tree.get(i).get_name() for i in range(0,tree.size())]) +def delete_recipe(repo, branch, recipe_name): + """Delete a recipe from a branch. + + :param repo: Open repository + :type repo: Git.Repository + :param branch: Branch name + :type branch: str + :param recipe_name: Recipe name to delete + :type recipe_name: str + :returns: OId of the new commit + :rtype: Git.OId + :raises: Can raise errors from Ggit + """ + return delete_file(repo, branch, recipe_filename(recipe_name)) + def delete_file(repo, branch, filename): """Delete a file from a branch. diff --git a/tests/pylorax/test_recipes.py b/tests/pylorax/test_recipes.py index 825d6a31..fc935763 100644 --- a/tests/pylorax/test_recipes.py +++ b/tests/pylorax/test_recipes.py @@ -174,7 +174,7 @@ class GitRecipesTest(unittest.TestCase): def test_08_delete_recipe(self): """Test deleting a file from a branch""" - oid = recipes.delete_file(self.repo, "master", "http-server.toml") + oid = recipes.delete_recipe(self.repo, "master", "http-server") self.assertNotEqual(oid, None) master_files = recipes.list_branch_files(self.repo, "master")