mirror of
https://github.com/ZwareBear/awx.git
synced 2026-03-20 07:43:35 -05:00
Merge pull request #13250 from jbradberry/fix-inventorysource-migration
Fix a problem with migration main/0164
This commit is contained in:
@@ -1,24 +1,14 @@
|
|||||||
# Generated by Django 3.2.13 on 2022-06-21 21:29
|
# Generated by Django 3.2.13 on 2022-06-21 21:29
|
||||||
|
|
||||||
from django.db import migrations
|
from django.db import migrations
|
||||||
import logging
|
|
||||||
|
|
||||||
logger = logging.getLogger("awx")
|
|
||||||
|
|
||||||
|
|
||||||
def forwards(apps, schema_editor):
|
def forwards(apps, schema_editor):
|
||||||
InventorySource = apps.get_model('main', 'InventorySource')
|
InventorySource = apps.get_model('main', 'InventorySource')
|
||||||
sources = InventorySource.objects.filter(update_on_project_update=True)
|
InventorySource.objects.filter(update_on_project_update=True).update(update_on_launch=True)
|
||||||
for src in sources:
|
|
||||||
if src.update_on_launch == False:
|
Project = apps.get_model('main', 'Project')
|
||||||
src.update_on_launch = True
|
Project.objects.filter(scm_inventory_sources__update_on_project_update=True).update(scm_update_on_launch=True)
|
||||||
src.save(update_fields=['update_on_launch'])
|
|
||||||
logger.info(f"Setting update_on_launch to True for {src}")
|
|
||||||
proj = src.source_project
|
|
||||||
if proj and proj.scm_update_on_launch is False:
|
|
||||||
proj.scm_update_on_launch = True
|
|
||||||
proj.save(update_fields=['scm_update_on_launch'])
|
|
||||||
logger.warning(f"Setting scm_update_on_launch to True for {proj}")
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|||||||
Reference in New Issue
Block a user