mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 18:09:57 -03:30
Fix migration bug
Bump migration number
Skip data migration for fresh migrations
where ContentType for custom inventory scripts
has not yet been created
no scripts will exist in this case, so no-op
This commit is contained in:
parent
f28ad90bf3
commit
b40e8d15c0
@ -10,7 +10,7 @@ from awx.main.migrations._inventory_source import delete_custom_inv_source
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('main', '0135_schedule_sort_fallback_to_id'),
|
||||
('main', '0136_scm_track_submodules'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
@ -6,7 +6,7 @@ from django.db import migrations, models
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('main', '0136_custom_inventory_scripts_removal_data'),
|
||||
('main', '0137_custom_inventory_scripts_removal_data'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
@ -50,7 +50,10 @@ def delete_all_user_roles(apps, schema_editor):
|
||||
def delete_all_custom_script_roles(apps, schema_editor):
|
||||
ContentType = apps.get_model('contenttypes', "ContentType")
|
||||
Role = apps.get_model('main', "Role")
|
||||
cis_type = ContentType.objects.get(model='custominventoryscript')
|
||||
try:
|
||||
cis_type = ContentType.objects.get(model='custominventoryscript')
|
||||
except ContentType.DoesNotExist:
|
||||
return
|
||||
role_ct = 0
|
||||
for role in Role.objects.filter(content_type=cis_type).iterator():
|
||||
role.delete()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user