Update the EE resolver logic

so that the control plane managed EE is kept separate.
This commit is contained in:
Jeff Bradberry 2021-06-07 15:55:15 -04:00
parent d4d21a1511
commit 9aa56b1247
2 changed files with 8 additions and 4 deletions

View File

@ -32,7 +32,7 @@ from awx.main.models.jobs import Job
from awx.main.models.mixins import ResourceMixin, TaskManagerProjectUpdateMixin, CustomVirtualEnvMixin, RelatedJobsMixin
from awx.main.utils import update_scm_url, polymorphic
from awx.main.utils.ansible import skip_directory, could_be_inventory, could_be_playbook
from awx.main.utils.execution_environments import get_default_execution_environment
from awx.main.utils.execution_environments import get_control_plane_execution_environment
from awx.main.fields import ImplicitRoleField
from awx.main.models.rbac import (
ROLE_SINGLETON_SYSTEM_ADMINISTRATOR,
@ -185,11 +185,11 @@ class ProjectOptions(models.Model):
def resolve_execution_environment(self):
"""
Project updates, themselves, will use the default execution environment.
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.
"""
return get_default_execution_environment()
return get_control_plane_execution_environment()
def get_project_path(self, check_if_exists=True):
local_path = os.path.basename(self.local_path)

View File

@ -6,10 +6,14 @@ from django.conf import settings
from awx.main.models.execution_environments import ExecutionEnvironment
def get_control_plane_execution_environment():
return ExecutionEnvironment.objects.filter(organization=None, managed_by_tower=True).first()
def get_default_execution_environment():
if settings.DEFAULT_EXECUTION_ENVIRONMENT is not None:
return settings.DEFAULT_EXECUTION_ENVIRONMENT
return ExecutionEnvironment.objects.filter(organization=None, managed_by_tower=True).first()
return ExecutionEnvironment.objects.filter(organization=None, managed_by_tower=False).first()
def get_default_pod_spec():