Move the git repo into a subdirectory
And fix the import of recipes (needs to have full path passed in).
This commit is contained in:
parent
5b0d662007
commit
90a8798f4c
@ -200,15 +200,16 @@ def open_or_create_repo(path):
|
||||
:rtype: Git.Repository
|
||||
:raises: Can raise errors from Ggit
|
||||
|
||||
A bare git repo will be created in at the specified path.
|
||||
A bare git repo will be created in the git directory of the specified path.
|
||||
If a repo already exists it will be opened and returned instead of
|
||||
creating a new one.
|
||||
"""
|
||||
Git.init()
|
||||
if os.path.exists(joinpaths(path, "HEAD")):
|
||||
return Git.Repository.open(gfile(path))
|
||||
git_path = joinpaths(path, "git")
|
||||
if os.path.exists(joinpaths(git_path, "HEAD")):
|
||||
return Git.Repository.open(gfile(git_path))
|
||||
|
||||
repo = Git.Repository.init_repository(gfile(path), True)
|
||||
repo = Git.Repository.init_repository(gfile(git_path), True)
|
||||
|
||||
# Make an initial empty commit
|
||||
sig = Git.Signature.new_now("bdcs-api-server", "user-email")
|
||||
@ -445,7 +446,7 @@ def commit_recipe_directory(repo, branch, directory):
|
||||
for f in new_files:
|
||||
# Skip files with errors, but try the others
|
||||
try:
|
||||
commit_recipe_file(repo, branch, f)
|
||||
commit_recipe_file(repo, branch, joinpaths(directory, f))
|
||||
except (RecipeFileError, toml.TomlError):
|
||||
pass
|
||||
|
||||
|
@ -105,6 +105,7 @@ class GitRecipesTest(unittest.TestCase):
|
||||
self.repo = recipes.open_or_create_repo(self.repo_dir)
|
||||
|
||||
self.results_path = "./tests/pylorax/results/"
|
||||
self.examples_path = "./tests/pylorax/recipes/"
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(self):
|
||||
@ -143,7 +144,7 @@ class GitRecipesTest(unittest.TestCase):
|
||||
def test_05_commit_toml_dir(self):
|
||||
"""Test committing a directory of TOML files"""
|
||||
# It worked if it doesn't raise errors
|
||||
recipes.commit_recipe_directory(self.repo, "master", self.results_path)
|
||||
recipes.commit_recipe_directory(self.repo, "master", self.examples_path)
|
||||
|
||||
def test_06_read_recipe(self):
|
||||
"""Test reading a recipe from a commit"""
|
||||
|
Loading…
Reference in New Issue
Block a user