mirror of
https://github.com/ansible/awx.git
synced 2024-10-27 17:55:10 +03:00
Merge pull request #13466 from john-westcott-iv/ee_debugging
Enhancing debugging of `The project could not sync because there is no Execution Environment`
This commit is contained in:
commit
23a34c5dc9
@ -311,7 +311,7 @@ class BaseTask(object):
|
|||||||
env['AWX_PRIVATE_DATA_DIR'] = private_data_dir
|
env['AWX_PRIVATE_DATA_DIR'] = private_data_dir
|
||||||
|
|
||||||
if self.instance.execution_environment is None:
|
if self.instance.execution_environment is None:
|
||||||
raise RuntimeError('The project could not sync because there is no Execution Environment.')
|
raise RuntimeError(f'The {self.model.__name__} could not run because there is no Execution Environment.')
|
||||||
|
|
||||||
return env
|
return env
|
||||||
|
|
||||||
|
@ -2008,7 +2008,7 @@ def test_project_update_no_ee(mock_me):
|
|||||||
with pytest.raises(RuntimeError) as e:
|
with pytest.raises(RuntimeError) as e:
|
||||||
task.build_env(job, {})
|
task.build_env(job, {})
|
||||||
|
|
||||||
assert 'The project could not sync because there is no Execution Environment' in str(e.value)
|
assert 'The ProjectUpdate could not run because there is no Execution Environment' in str(e.value)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
|
import logging
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
@ -6,8 +7,15 @@ from django.conf import settings
|
|||||||
from awx.main.models.execution_environments import ExecutionEnvironment
|
from awx.main.models.execution_environments import ExecutionEnvironment
|
||||||
|
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def get_control_plane_execution_environment():
|
def get_control_plane_execution_environment():
|
||||||
return ExecutionEnvironment.objects.filter(organization=None, managed=True).first()
|
ee = ExecutionEnvironment.objects.filter(organization=None, managed=True).first()
|
||||||
|
if ee == None:
|
||||||
|
logger.error('Failed to find control plane ee, there are no managed EEs without organizations')
|
||||||
|
raise RuntimeError("Failed to find default control plane EE")
|
||||||
|
return ee
|
||||||
|
|
||||||
|
|
||||||
def get_default_execution_environment():
|
def get_default_execution_environment():
|
||||||
|
Loading…
Reference in New Issue
Block a user