mirror of
https://github.com/ZwareBear/awx.git
synced 2026-05-06 16:32:01 -05:00
do not use a custom task exception
* Celery + json pickling do not handle custom Exceptions (and may never do so). Mentioning of, if handling custom Exceptions then the code would be susceptible to same arbitrary code execution that python pickle is vulnerable to. * So don't use custom Exceptions.
This commit is contained in:
@@ -50,7 +50,7 @@ from awx import celery_app
|
||||
from awx.main.constants import CLOUD_PROVIDERS, PRIVILEGE_ESCALATION_METHODS
|
||||
from awx.main.models import * # noqa
|
||||
from awx.main.models.unified_jobs import ACTIVE_STATES
|
||||
from awx.main.exceptions import AwxTaskError, TaskCancel, TaskError
|
||||
from awx.main.exceptions import AwxTaskError
|
||||
from awx.main.queue import CallbackQueueDispatcher
|
||||
from awx.main.expect import run, isolated_manager
|
||||
from awx.main.utils import (get_ansible_version, get_ssh_version, decrypt_field, update_scm_url,
|
||||
@@ -81,7 +81,7 @@ logger = logging.getLogger('awx.main.tasks')
|
||||
|
||||
class LogErrorsTask(Task):
|
||||
def on_failure(self, exc, task_id, args, kwargs, einfo):
|
||||
if isinstance(exc, AwxTaskError):
|
||||
if getattr(exc, 'is_awx_task_error', False):
|
||||
# Error caused by user / tracked in job output
|
||||
logger.warning(str(exc))
|
||||
elif isinstance(self, BaseTask):
|
||||
@@ -913,9 +913,9 @@ class BaseTask(LogErrorsTask):
|
||||
# Raising an exception will mark the job as 'failed' in celery
|
||||
# and will stop a task chain from continuing to execute
|
||||
if status == 'canceled':
|
||||
raise TaskCancel(instance, rc)
|
||||
raise AwxTaskError.TaskCancel(instance, rc)
|
||||
else:
|
||||
raise TaskError(instance, rc)
|
||||
raise AwxTaskError.TaskError(instance, rc)
|
||||
|
||||
def get_ssh_key_path(self, instance, **kwargs):
|
||||
'''
|
||||
|
||||
Reference in New Issue
Block a user