From 672b82c3d654ed164b9ff1bc637cff806bac7aef Mon Sep 17 00:00:00 2001 From: ibuler Date: Mon, 16 Mar 2020 19:24:48 +0800 Subject: [PATCH] =?UTF-8?q?[Bugfix]=20=E4=BF=AE=E5=A4=8D=E5=8F=AF=E8=83=BD?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E6=89=BE=E5=88=B0command=20execution?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/ops/tasks.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/ops/tasks.py b/apps/ops/tasks.py index 33d7cb850..0967ac482 100644 --- a/apps/ops/tasks.py +++ b/apps/ops/tasks.py @@ -10,6 +10,7 @@ from django.utils import timezone from django.utils.translation import ugettext_lazy as _ from common.utils import get_logger, get_object_or_none, get_disk_usage +from orgs.utils import tmp_to_root_org from .celery.decorator import ( register_as_period_task, after_app_shutdown_clean_periodic, after_app_ready_start @@ -44,7 +45,8 @@ def run_ansible_task(tid, callback=None, **kwargs): @shared_task(soft_time_limit=60, queue="ansible") def run_command_execution(cid, **kwargs): - execution = get_object_or_none(CommandExecution, id=cid) + with tmp_to_root_org(): + execution = get_object_or_none(CommandExecution, id=cid) if execution: try: os.environ.update({