mirror of
https://github.com/ansible/awx.git
synced 2026-02-28 00:08:44 -03:30
UnifiedJob#is_containerized -> UnifiedJob#is_container_group_task
This commit is contained in:
@@ -48,7 +48,7 @@ class IsolatedManager(object):
|
|||||||
self.pod_manager = pod_manager
|
self.pod_manager = pod_manager
|
||||||
|
|
||||||
def build_inventory(self, hosts):
|
def build_inventory(self, hosts):
|
||||||
if self.instance and self.instance.is_containerized:
|
if self.instance and self.instance.is_container_group_task:
|
||||||
inventory = {'all': {'hosts': {}}}
|
inventory = {'all': {'hosts': {}}}
|
||||||
fd, path = tempfile.mkstemp(
|
fd, path = tempfile.mkstemp(
|
||||||
prefix='.kubeconfig', dir=self.private_data_dir
|
prefix='.kubeconfig', dir=self.private_data_dir
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ class InstanceGroupManager(models.Manager):
|
|||||||
elif t.status == 'running':
|
elif t.status == 'running':
|
||||||
# Subtract capacity from all groups that contain the instance
|
# Subtract capacity from all groups that contain the instance
|
||||||
if t.execution_node not in instance_ig_mapping:
|
if t.execution_node not in instance_ig_mapping:
|
||||||
if not t.is_containerized:
|
if not t.is_container_group_task:
|
||||||
logger.warning('Detected %s running inside lost instance, '
|
logger.warning('Detected %s running inside lost instance, '
|
||||||
'may still be waiting for reaper.', t.log_format)
|
'may still be waiting for reaper.', t.log_format)
|
||||||
if t.instance_group:
|
if t.instance_group:
|
||||||
|
|||||||
@@ -1490,7 +1490,7 @@ class UnifiedJob(PolymorphicModel, PasswordFieldsModel, CommonModelNameNotUnique
|
|||||||
return bool(self.controller_node)
|
return bool(self.controller_node)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_containerized(self):
|
def is_container_group_task(self):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def log_lifecycle(self, state, blocked_by=None):
|
def log_lifecycle(self, state, blocked_by=None):
|
||||||
|
|||||||
@@ -594,7 +594,7 @@ class TaskManager():
|
|||||||
).exclude(
|
).exclude(
|
||||||
execution_node__in=Instance.objects.values_list('hostname', flat=True)
|
execution_node__in=Instance.objects.values_list('hostname', flat=True)
|
||||||
):
|
):
|
||||||
if j.execution_node and not j.is_containerized:
|
if j.execution_node and not j.is_container_group_task:
|
||||||
logger.error(f'{j.execution_node} is not a registered instance; reaping {j.log_format}')
|
logger.error(f'{j.execution_node} is not a registered instance; reaping {j.log_format}')
|
||||||
reap_job(j, 'failed')
|
reap_job(j, 'failed')
|
||||||
|
|
||||||
|
|||||||
@@ -1867,7 +1867,7 @@ class RunJob(BaseTask):
|
|||||||
'''
|
'''
|
||||||
Return whether this task should use proot.
|
Return whether this task should use proot.
|
||||||
'''
|
'''
|
||||||
if job.is_containerized:
|
if job.is_container_group_task:
|
||||||
return False
|
return False
|
||||||
return getattr(settings, 'AWX_PROOT_ENABLED', False)
|
return getattr(settings, 'AWX_PROOT_ENABLED', False)
|
||||||
|
|
||||||
@@ -1997,7 +1997,7 @@ class RunJob(BaseTask):
|
|||||||
os.path.join(private_data_dir, 'artifacts', 'fact_cache'),
|
os.path.join(private_data_dir, 'artifacts', 'fact_cache'),
|
||||||
fact_modification_times,
|
fact_modification_times,
|
||||||
)
|
)
|
||||||
if isolated_manager_instance and not job.is_containerized:
|
if isolated_manager_instance and not job.is_container_group_task:
|
||||||
isolated_manager_instance.cleanup()
|
isolated_manager_instance.cleanup()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -2994,7 +2994,7 @@ class RunAdHocCommand(BaseTask):
|
|||||||
'''
|
'''
|
||||||
Return whether this task should use proot.
|
Return whether this task should use proot.
|
||||||
'''
|
'''
|
||||||
if ad_hoc_command.is_containerized:
|
if ad_hoc_command.is_container_group_task:
|
||||||
return False
|
return False
|
||||||
return getattr(settings, 'AWX_PROOT_ENABLED', False)
|
return getattr(settings, 'AWX_PROOT_ENABLED', False)
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ def containerized_job(default_instance_group, kube_credential, job_template_fact
|
|||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_containerized_job(containerized_job):
|
def test_containerized_job(containerized_job):
|
||||||
assert containerized_job.is_containerized
|
assert containerized_job.is_container_group_task
|
||||||
assert containerized_job.instance_group.is_container_group
|
assert containerized_job.instance_group.is_container_group
|
||||||
assert containerized_job.instance_group.credential.kubernetes
|
assert containerized_job.instance_group.credential.kubernetes
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class FakeObject(object):
|
|||||||
|
|
||||||
class Job(FakeObject):
|
class Job(FakeObject):
|
||||||
task_impact = 43
|
task_impact = 43
|
||||||
is_containerized = False
|
is_container_group_task = False
|
||||||
|
|
||||||
def log_format(self):
|
def log_format(self):
|
||||||
return 'job 382 (fake)'
|
return 'job 382 (fake)'
|
||||||
|
|||||||
Reference in New Issue
Block a user