Skip to content

Commit

Permalink
Attempt to add bootstrapping for imports
Browse files Browse the repository at this point in the history
  • Loading branch information
djyasin committed Sep 19, 2024
1 parent 3b9f0db commit 1e5f699
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
16 changes: 16 additions & 0 deletions awx/main/apps.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
from awx.main.utils.common import bypass_in_test
from awx.main.models.inventory import InventorySourceOptions
from awx.main.utils.migration import is_database_synchronized
from awx.main.utils.named_url_graph import _customize_graph, generate_graph
from awx.conf import register, fields
Expand Down Expand Up @@ -63,3 +64,18 @@ def ready(self):

self.load_credential_types_feature()
self.load_named_url_feature()

def load_cloud_provider_plugin_names(self):
from awx.main.models.inventory import InventorySourceOptions

if is_database_synchronized():
InventorySourceOptions.load_plugin_names(app_config=self)

@bypass_in_test
def _load_cloud_provider_plugin_names(self):
return self._load_cloud_provider_plugin_names()

def ready(self):
super().ready()

self.load_cloud_provider_plugin_names()
12 changes: 8 additions & 4 deletions awx/main/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@

import re

from django.utils.translation import gettext_lazy as _

from awx.main.models.inventory import InventorySourceOptions
from django.utils.translation import gettext_lazy as _

__all__ = [
'CLOUD_PROVIDERS',
Expand All @@ -16,10 +15,15 @@
'STANDARD_INVENTORY_UPDATE_ENV',
]

plugin_names = tuple(InventorySourceOptions.injectors.keys())

def load_plugin_names():
from awx.main.models.inventory import InventorySourceOptions

plugin_names = tuple(InventorySourceOptions.injectors.keys())
return plugin_names


CLOUD_PROVIDERS = plugin_names
CLOUD_PROVIDERS = load_plugin_names
PRIVILEGE_ESCALATION_METHODS = [
('sudo', _('Sudo')),
('su', _('Su')),
Expand Down

0 comments on commit 1e5f699

Please sign in to comment.