summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Meyers <chris.meyers.fsu@gmail.com>2024-11-15 19:08:34 +0100
committerChris Meyers <chrismeyersfsu@users.noreply.github.com>2024-11-18 20:18:24 +0100
commit108cf843d44af87c7981f72ee8f7c7b6d6903148 (patch)
treeec5dd0374e049673412ebbc7c8d616a183c486d9
parentFix error with CLI monitor of ad hoc output (#15642) (diff)
downloadawx-108cf843d44af87c7981f72ee8f7c7b6d6903148.tar.xz
awx-108cf843d44af87c7981f72ee8f7c7b6d6903148.zip
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.
-rw-r--r--awx/main/apps.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/awx/main/apps.py b/awx/main/apps.py
index 1dbfa4879b..8853a2f50d 100644
--- a/awx/main/apps.py
+++ b/awx/main/apps.py
@@ -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()