mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 01:57:35 -03:30
Add option to skip credential type discovery
* Option to avoid database operations in django init path. Useful for running collectstatic, or other management commands, without a database.
This commit is contained in:
parent
d26396ce74
commit
108cf843d4
@ -1,3 +1,5 @@
|
||||
import os
|
||||
|
||||
from django.apps import AppConfig
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from awx.main.utils.common import bypass_in_test
|
||||
@ -61,5 +63,11 @@ class MainConfig(AppConfig):
|
||||
def ready(self):
|
||||
super().ready()
|
||||
|
||||
self.load_credential_types_feature()
|
||||
"""
|
||||
Credential loading triggers database operations. There are cases we want to call
|
||||
awx-manage collectstatic without a database. All management commands invoke the ready() code
|
||||
path. Using settings.AWX_SKIP_CREDENTIAL_TYPES_DISCOVER _could_ invoke a database operation.
|
||||
"""
|
||||
if not os.environ.get('AWX_SKIP_CREDENTIAL_TYPES_DISCOVER', None):
|
||||
self.load_credential_types_feature()
|
||||
self.load_named_url_feature()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user