Fix migration order of operations bug

This commit is contained in:
Alan Rominger 2021-04-17 10:54:07 -04:00
parent 5f39b6276d
commit 8241ebbc9a
No known key found for this signature in database
GPG Key ID: C2D7EAAA12B63559
3 changed files with 4 additions and 3 deletions

View File

@ -3,7 +3,6 @@
from django.db import migrations
# AWX migration utils
from awx.main.migrations._rbac import delete_all_custom_script_roles
from awx.main.migrations._inventory_source import delete_custom_inv_source
@ -15,5 +14,4 @@ class Migration(migrations.Migration):
operations = [
migrations.RunPython(delete_custom_inv_source),
migrations.RunPython(delete_all_custom_script_roles),
]

View File

@ -2,6 +2,8 @@
from django.db import migrations, models
from awx.main.migrations._rbac import delete_all_custom_script_roles
class Migration(migrations.Migration):
@ -78,4 +80,5 @@ class Migration(migrations.Migration):
model_name='custominventoryscript',
name='read_role',
),
migrations.RunPython(delete_all_custom_script_roles),
]

View File

@ -59,7 +59,7 @@ def delete_all_custom_script_roles(apps, schema_editor):
role.delete()
role_ct += 1
if role_ct:
logger.debug('Deleted roles corresponding to custom inventory sources.')
logger.debug('Deleted {} roles corresponding to custom inventory sources.'.format(role_ct))
UNIFIED_ORG_LOOKUPS = {