mirror of
https://github.com/ansible/awx.git
synced 2026-05-19 23:07:42 -02:30
Register CredentialType(s) every time Django loads
* Register all discovered CredentialType(s) after Django finishes loading * Protect parallel registrations using shared postgres advisory lock * The down-side of this is that this will run when it does not need to, adding overhead to the init process. * Only register discovered credential types in the database IF migrations have ran and are up-to-date.
This commit is contained in:
committed by
Chris Meyers
parent
71856d61c9
commit
490db08224
@@ -10,4 +10,9 @@ class Command(BaseCommand):
|
||||
help = 'Load default managed credential types.'
|
||||
|
||||
def handle(self, *args, **options):
|
||||
CredentialType.setup_tower_managed_defaults()
|
||||
"""
|
||||
Note that the call below is almost redundant. The same call as below is called in the Django ready() code path. The ready() code path runs
|
||||
before every management command. The one difference in the below call is that the below call is _more_ likely to _actually_ run. The ready() code path
|
||||
version _can_ be a NOOP if the lock is not acquired. The below version waits to acquire the lock. This can be useful for recreating bugs or pdb.
|
||||
"""
|
||||
CredentialType.setup_tower_managed_defaults(wait_for_lock=True)
|
||||
|
||||
Reference in New Issue
Block a user