mirror of
https://github.com/ansible/awx.git
synced 2026-06-27 09:28:01 -02:30
Create system_administrator rbac role in migration
* We had race conditions with the system_administrator role being created just-in-time. Instead of fixing the race condition(s), dodge them by ensuring the role always exists
This commit is contained in:
committed by
Chris Meyers
parent
622f6ea166
commit
f51af03424
@@ -10,6 +10,11 @@ def setup_tower_managed_defaults(apps, schema_editor):
|
||||
CredentialType.setup_tower_managed_defaults(apps)
|
||||
|
||||
|
||||
def setup_rbac_role_system_administrator(apps, schema_editor):
|
||||
Role = apps.get_model('main', 'Role')
|
||||
Role.objects.get_or_create(singleton_name='system_administrator', role_field='system_administrator')
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('main', '0200_template_name_constraint'),
|
||||
@@ -17,4 +22,5 @@ class Migration(migrations.Migration):
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(setup_tower_managed_defaults),
|
||||
migrations.RunPython(setup_rbac_role_system_administrator),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user