diff --git a/awx/main/models/inventory.py b/awx/main/models/inventory.py index a592757295..b958010f4c 100644 --- a/awx/main/models/inventory.py +++ b/awx/main/models/inventory.py @@ -49,7 +49,7 @@ from awx.main.models.notifications import ( from awx.main.models.credential.injectors import _openstack_data from awx.main.utils import _inventory_updates 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 @@ -951,6 +951,16 @@ class InventorySourceOptions(BaseModel): 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 def cloud_credential_validation(source, cred): if not source: diff --git a/awx/settings/defaults.py b/awx/settings/defaults.py index 393247cf1b..06c12cc26c 100644 --- a/awx/settings/defaults.py +++ b/awx/settings/defaults.py @@ -172,7 +172,9 @@ GLOBAL_JOB_EXECUTION_ENVIRONMENTS = [{'name': 'AWX EE (latest)', 'image': 'quay. # This image is distinguished from others by having "managed" set to True and users have limited # ability to modify it through the API. # If a registry credential is needed to pull the image, that can be provided to the awx-manage command -CONTROL_PLANE_EXECUTION_ENVIRONMENT = 'quay.io/ansible/awx-ee:latest' + +# HACK: this is done temporarily for feature development, remove before merge +CONTROL_PLANE_EXECUTION_ENVIRONMENT = 'quay.io/relrod/awx-ee-invlimit:latest' # Note: This setting may be overridden by database settings. STDOUT_MAX_BYTES_DISPLAY = 1048576 diff --git a/awxkit/awxkit/api/pages/inventory.py b/awxkit/awxkit/api/pages/inventory.py index 354fa2abbb..1eee3b6571 100644 --- a/awxkit/awxkit/api/pages/inventory.py +++ b/awxkit/awxkit/api/pages/inventory.py @@ -126,7 +126,16 @@ class Inventory(HasCopy, HasCreate, HasInstanceGroups, HasVariables, base.Base): 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): @@ -134,7 +143,7 @@ class Inventories(page.PageList, Inventory): 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): diff --git a/awxkit/awxkit/api/resources.py b/awxkit/awxkit/api/resources.py index 982e7c2573..b0789e3cf4 100644 --- a/awxkit/awxkit/api/resources.py +++ b/awxkit/awxkit/api/resources.py @@ -58,7 +58,9 @@ class Resources(object): _instance_related_jobs = r'instances/\d+/jobs/' _instances = 'instances/' _inventories = 'inventories/' + _constructed_inventories = 'constructed_inventories/' _inventory = r'inventories/\d+/' + _constructed_inventory = r'constructed_inventories/\d+/' _inventory_access_list = r'inventories/\d+/access_list/' _inventory_copy = r'inventories/\d+/copy/' _inventory_labels = r'inventories/\d+/labels/'