Merge pull request #10456 from jbradberry/danger-danger-will-robinson

Remove isolated instances and groups

SUMMARY
before we remove the fields that allow us to correctly identify them.
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME

API

Reviewed-by: Alan Rominger <arominge@redhat.com>
Reviewed-by: Jeff Bradberry <None>
Reviewed-by: Chris Meyers <None>
This commit is contained in:
softwarefactory-project-zuul[bot] 2021-06-16 15:30:48 +00:00 committed by GitHub
commit d4a3143b0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,16 @@
from django.db import migrations, models
def remove_iso_instances(apps, schema_editor):
Instance = apps.get_model('main', 'Instance')
Instance.objects.filter(rampart_groups__controller__isnull=False).delete()
def remove_iso_groups(apps, schema_editor):
InstanceGroup = apps.get_model('main', 'InstanceGroup')
InstanceGroup.objects.filter(controller__isnull=False).delete()
class Migration(migrations.Migration):
dependencies = [
@ -10,6 +20,8 @@ class Migration(migrations.Migration):
]
operations = [
migrations.RunPython(remove_iso_instances),
migrations.RunPython(remove_iso_groups),
migrations.RemoveField(
model_name='instance',
name='last_isolated_check',