mirror of https://github.com/jumpserver/jumpserver
perf: Add check for SECURITY_COMMAND_EXECUTION settings in ops tasks
parent
6686afcec1
commit
690f525afc
|
@ -7,6 +7,7 @@ from celery.exceptions import SoftTimeLimitExceeded
|
|||
from django.utils import timezone
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django_celery_beat.models import PeriodicTask
|
||||
from django.conf import settings
|
||||
|
||||
from common.const.crontab import CRONTAB_AT_AM_TWO
|
||||
from common.utils import get_logger, get_object_or_none, get_log_keep_day
|
||||
|
@ -51,6 +52,8 @@ def _run_ops_job_execution(execution):
|
|||
activity_callback=job_task_activity_callback
|
||||
)
|
||||
def run_ops_job(job_id):
|
||||
if not settings.SECURITY_COMMAND_EXECUTION:
|
||||
return
|
||||
with tmp_to_root_org():
|
||||
job = get_object_or_none(Job, id=job_id)
|
||||
if not job:
|
||||
|
@ -77,6 +80,8 @@ def job_execution_task_activity_callback(self, execution_id, *args, **kwargs):
|
|||
activity_callback=job_execution_task_activity_callback
|
||||
)
|
||||
def run_ops_job_execution(execution_id, **kwargs):
|
||||
if not settings.SECURITY_COMMAND_EXECUTION:
|
||||
return
|
||||
with tmp_to_root_org():
|
||||
execution = get_object_or_none(JobExecution, id=execution_id)
|
||||
|
||||
|
|
Loading…
Reference in New Issue