Skip to content

Commit

Permalink
fix(cleanup): remove stale directories for components switched to link
Browse files Browse the repository at this point in the history
  • Loading branch information
nijel committed May 10, 2024
1 parent 412920b commit 9ccaedd
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions weblate/trans/tasks.py
Expand Up @@ -251,14 +251,17 @@ def cleanup_stale_repos(root: Path | None = None) -> bool:

try:
# Find matching components
parse_path(
component: Component = parse_path(
None, path.relative_to(vcs_root).parts, (Component,), skip_acl=True
)
except Http404:
# Remove stale dir
LOGGER.info("removing stale VCS path: %s", path)
LOGGER.info("removing stale VCS path (not found): %s", path)
remove_tree(path)
else:
if component.is_repo_link():
LOGGER.info("removing stale VCS path (uses link): %s", root)
root.rmdir()
empty_dir = False

if empty_dir and root != vcs_root:
Expand All @@ -271,7 +274,7 @@ def cleanup_stale_repos(root: Path | None = None) -> bool:
skip_acl=True,
)
except Http404:
LOGGER.info("removing stale VCS path: %s", root)
LOGGER.info("removing stale VCS path (not found): %s", root)
root.rmdir()
else:
empty_dir = False
Expand Down

2 comments on commit 9ccaedd

@tipa
Copy link
Contributor

@tipa tipa commented on 9ccaedd May 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nijel I believe this change caused an error in my deployment

image

@nijel
Copy link
Member Author

@nijel nijel commented on 9ccaedd May 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing this out! 1cbca01 should fix this.

Please sign in to comment.