Skip to content

Commit

Permalink
better handling of uninitialized templates repo, when refreshing sett…
Browse files Browse the repository at this point in the history
…ings before first refresh of templates for ex
  • Loading branch information
indy-independence committed Aug 22, 2024
1 parent 15c1090 commit 5b5b02f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/cnaas_nms/db/git_worktrees.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ def refresh_templates_worktree(branch: str):
branch_folder = get_branch_folder(branch)
if os.path.isdir(branch_folder):
return
local_repo = Repo(app_settings.TEMPLATES_LOCAL)
try:
local_repo = Repo(app_settings.TEMPLATES_LOCAL)
except git.exc.InvalidGitRepositoryError:
logger.warning(

Check warning on line 37 in src/cnaas_nms/db/git_worktrees.py

View check run for this annotation

Codecov / codecov/patch

src/cnaas_nms/db/git_worktrees.py#L34-L37

Added lines #L34 - L37 were not covered by tests
"Could not add worktree for templates branch {}: templates repository is not initialized".format(branch)
)
return
if not os.path.isdir("/tmp/worktrees"):
os.mkdir("/tmp/worktrees")
logger.debug("Adding worktree for templates branch {} in folder {}".format(branch, branch_folder))
Expand Down

0 comments on commit 5b5b02f

Please sign in to comment.