remove the legacy fact cleanup system template

see: https://github.com/ansible/tower/issues/1021
This commit is contained in:
Ryan Petrello
2018-04-25 14:20:19 -04:00
parent 9319bbce8d
commit 0bc5665e92
4 changed files with 28 additions and 14 deletions
@@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
# AWX
from awx.main.migrations._scan_jobs import remove_legacy_fact_cleanup
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('main', '0036_v330_credtype_remove_become_methods'),
]
operations = [
migrations.RunPython(remove_legacy_fact_cleanup),
]
+8
View File
@@ -102,3 +102,11 @@ def remove_scan_type_nodes(apps, schema_editor):
prompts.pop('job_type')
node.char_prompts = prompts
node.save()
def remove_legacy_fact_cleanup(apps, schema_editor):
SystemJobTemplate = apps.get_model('main', 'SystemJobTemplate')
for job in SystemJobTemplate.objects.filter(job_type='cleanup_facts').all():
for sched in job.schedules.all():
sched.delete()
job.delete()