Skip to content

Commit

Permalink
rules: fix migration for master
Browse files Browse the repository at this point in the history
  • Loading branch information
regit committed May 2, 2024
1 parent fa5a72f commit 1b1bf79
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions rules/migrations/0102_auto_20230626_1624.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@ def migration_2(apps, _):
ruleset.sources.set(Source.objects.filter(pk__in=sources_pk))

# remove git directories
for item in os.listdir(settings.GIT_SOURCES_BASE_DIRECTORY):
full_path = os.path.join(settings.GIT_SOURCES_BASE_DIRECTORY, item)
if os.path.isdir(full_path) and item.isdigit():
git_path = os.path.join(full_path, '.git')
if os.path.exists(git_path):
shutil.rmtree(git_path)
if os.path.exists(settings.GIT_SOURCES_BASE_DIRECTORY):
for item in os.listdir(settings.GIT_SOURCES_BASE_DIRECTORY):
full_path = os.path.join(settings.GIT_SOURCES_BASE_DIRECTORY, item)
if os.path.isdir(full_path) and item.isdigit():
git_path = os.path.join(full_path, '.git')
if os.path.exists(git_path):
shutil.rmtree(git_path)


class Migration(migrations.Migration):
Expand Down

0 comments on commit 1b1bf79

Please sign in to comment.