-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'ansible:devel' into devel
- Loading branch information
Showing
10 changed files
with
108 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
awx/main/migrations/0198_alter_inventorysource_source_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Generated by Django 4.2.10 on 2024-10-22 15:58 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('main', '0197_remove_sso_app_content'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='inventorysource', | ||
name='source', | ||
field=models.CharField(default=None, max_length=32), | ||
), | ||
migrations.AlterField( | ||
model_name='inventoryupdate', | ||
name='source', | ||
field=models.CharField(default=None, max_length=32), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Copyright (c) 2024 Ansible, Inc. | ||
# All Rights Reserved. | ||
|
||
""" | ||
This module contains the code responsible for extracting the lists of dynamically discovered plugins. | ||
""" | ||
|
||
from functools import cache | ||
|
||
|
||
@cache | ||
def discover_available_cloud_provider_plugin_names() -> list[str]: | ||
""" | ||
Return a list of cloud plugin names available in runtime. | ||
The discovery result is cached since it does not change throughout | ||
the life cycle of the server run. | ||
:returns: List of plugin cloud names. | ||
:rtype: list[str] | ||
""" | ||
from awx.main.models.inventory import InventorySourceOptions | ||
|
||
plugin_names = list(InventorySourceOptions.injectors.keys()) | ||
|
||
plugin_names.remove('constructed') | ||
|
||
return plugin_names | ||
|
||
|
||
@cache | ||
def compute_cloud_inventory_sources() -> dict[str, str]: | ||
""" | ||
Return a dictionary of cloud provider plugin names | ||
available plus source control management and constructed. | ||
:returns: Dictionary of plugin cloud names plus source control. | ||
:rtype: dict[str, str] | ||
""" | ||
|
||
plugins = discover_available_cloud_provider_plugin_names() | ||
|
||
return dict(zip(plugins, plugins), scm='scm', constructed='constructed') | ||
|
||
|
||
@cache | ||
def load_combined_inventory_source_options() -> dict[str, str]: | ||
""" | ||
Return a dictionary of cloud provider plugin names and 'file'. | ||
The 'file' entry is included separately since it needs to be consumed directly by the serializer. | ||
:returns: A dictionary of cloud provider plugin names (as both keys and values) plus the 'file' entry. | ||
:rtype: dict[str, str] | ||
""" | ||
|
||
plugins = compute_cloud_inventory_sources() | ||
|
||
return dict(zip(plugins, plugins), file='file') |