Skip to content

Commit

Permalink
remove zones for archived projects
Browse files Browse the repository at this point in the history
  • Loading branch information
claire-peters committed Aug 8, 2024
1 parent 1749eb2 commit fcc6210
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions coldfront/plugins/sftocf/management/commands/update_zones.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,13 @@ def handle(self, *args, **options):
print(project, project.pk)
zone = sf.get_zones(project.sf_zone)
zone_paths_not_in_cf = [p for p in zone['paths'] if p.split(':')[0] not in sf_cf_vols]
# delete any zones that have no paths
if not zone_paths_not_in_cf:
# delete any zones that have no paths or belong to inactive projects
if not zone_paths_not_in_cf or project.status.name == 'Archived':
if not dry_run:
if project.status.name == 'Archived':
logger.warning('Project %s is archived; deleting zone', project)
elif not zone_paths_not_in_cf:
logger.warning('Zone %s has no paths; deleting', zone['name'])
sf.delete_zone(zone['id'])
# delete projectattribute
project.projectattribute_set.get(
Expand Down

0 comments on commit fcc6210

Please sign in to comment.