mirror of
https://github.com/ansible/awx.git
synced 2026-02-26 23:46:05 -03:30
[constructed-inventory] Use control plane EE for constructed inventory and hack temporary image (#13474)
* Use control plane EE for constructed inventory and hack temporary image * Update page registry to work with new endpoints
This commit is contained in:
committed by
Rick Elrod
parent
510f54b904
commit
c2fe06dd95
@@ -49,7 +49,7 @@ from awx.main.models.notifications import (
|
|||||||
from awx.main.models.credential.injectors import _openstack_data
|
from awx.main.models.credential.injectors import _openstack_data
|
||||||
from awx.main.utils import _inventory_updates
|
from awx.main.utils import _inventory_updates
|
||||||
from awx.main.utils.safe_yaml import sanitize_jinja
|
from awx.main.utils.safe_yaml import sanitize_jinja
|
||||||
from awx.main.utils.execution_environments import to_container_path
|
from awx.main.utils.execution_environments import to_container_path, get_control_plane_execution_environment
|
||||||
from awx.main.utils.licensing import server_product_name
|
from awx.main.utils.licensing import server_product_name
|
||||||
|
|
||||||
|
|
||||||
@@ -995,6 +995,16 @@ class InventorySourceOptions(BaseModel):
|
|||||||
help_text=_("Enter host, group or pattern match"),
|
help_text=_("Enter host, group or pattern match"),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def resolve_execution_environment(self):
|
||||||
|
"""
|
||||||
|
Project updates, themselves, will use the control plane execution environment.
|
||||||
|
Jobs using the project can use the default_environment, but the project updates
|
||||||
|
are not flexible enough to allow customizing the image they use.
|
||||||
|
"""
|
||||||
|
if self.inventory.kind == 'constructed':
|
||||||
|
return get_control_plane_execution_environment()
|
||||||
|
return super().resolve_execution_environment()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def cloud_credential_validation(source, cred):
|
def cloud_credential_validation(source, cred):
|
||||||
if not source:
|
if not source:
|
||||||
|
|||||||
@@ -125,14 +125,23 @@ class Inventory(HasCopy, HasCreate, HasInstanceGroups, HasVariables, base.Base):
|
|||||||
return inv_updates
|
return inv_updates
|
||||||
|
|
||||||
|
|
||||||
page.register_page([resources.inventory, (resources.inventories, 'post'), (resources.inventory_copy, 'post')], Inventory)
|
page.register_page(
|
||||||
|
[
|
||||||
|
resources.inventory,
|
||||||
|
resources.constructed_inventory,
|
||||||
|
(resources.inventories, 'post'),
|
||||||
|
(resources.inventory_copy, 'post'),
|
||||||
|
(resources.constructed_inventories, 'post'),
|
||||||
|
],
|
||||||
|
Inventory,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class Inventories(page.PageList, Inventory):
|
class Inventories(page.PageList, Inventory):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
page.register_page([resources.inventories, resources.related_inventories], Inventories)
|
page.register_page([resources.inventories, resources.related_inventories, resources.constructed_inventories], Inventories)
|
||||||
|
|
||||||
|
|
||||||
class Group(HasCreate, HasVariables, base.Base):
|
class Group(HasCreate, HasVariables, base.Base):
|
||||||
|
|||||||
@@ -59,7 +59,9 @@ class Resources(object):
|
|||||||
_instance_related_jobs = r'instances/\d+/jobs/'
|
_instance_related_jobs = r'instances/\d+/jobs/'
|
||||||
_instances = 'instances/'
|
_instances = 'instances/'
|
||||||
_inventories = 'inventories/'
|
_inventories = 'inventories/'
|
||||||
|
_constructed_inventories = 'constructed_inventories/'
|
||||||
_inventory = r'inventories/\d+/'
|
_inventory = r'inventories/\d+/'
|
||||||
|
_constructed_inventory = r'constructed_inventories/\d+/'
|
||||||
_inventory_access_list = r'inventories/\d+/access_list/'
|
_inventory_access_list = r'inventories/\d+/access_list/'
|
||||||
_inventory_copy = r'inventories/\d+/copy/'
|
_inventory_copy = r'inventories/\d+/copy/'
|
||||||
_inventory_labels = r'inventories/\d+/labels/'
|
_inventory_labels = r'inventories/\d+/labels/'
|
||||||
|
|||||||
Reference in New Issue
Block a user