mirror of
https://github.com/ansible/awx.git
synced 2026-03-19 09:57:33 -02:30
Remove isolated instances and groups
before we remove the fields that allow us to correctly identify them.
This commit is contained in:
@@ -3,6 +3,16 @@
|
|||||||
from django.db import migrations, models
|
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):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
@@ -10,6 +20,8 @@ class Migration(migrations.Migration):
|
|||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
migrations.RunPython(remove_iso_instances),
|
||||||
|
migrations.RunPython(remove_iso_groups),
|
||||||
migrations.RemoveField(
|
migrations.RemoveField(
|
||||||
model_name='instance',
|
model_name='instance',
|
||||||
name='last_isolated_check',
|
name='last_isolated_check',
|
||||||
|
|||||||
Reference in New Issue
Block a user