mirror of
https://github.com/ZwareBear/awx.git
synced 2026-05-15 01:38:37 -05:00
remove the legacy fact cleanup system template
see: https://github.com/ansible/tower/issues/1021
This commit is contained in:
@@ -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),
|
||||
]
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user