Merge pull request #5280 from jumpserver/pr@dev@fix_auto_push

fix: 推送系统用户时 AdHocExecution id 重复
pull/5283/head
老广 4 years ago committed by GitHub
commit 4f04a7d258
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -180,8 +180,10 @@ class AdHoc(OrgModelMixin):
def run(self):
try:
hid = current_task.request.id
if AdHocExecution.objects.filter(id=hid).exists():
hid = uuid.uuid4()
except AttributeError:
hid = str(uuid.uuid4())
hid = uuid.uuid4()
execution = AdHocExecution(
id=hid, adhoc=self, task=self.task,
task_display=str(self.task)[:128],

@ -3,7 +3,7 @@ from django.utils.translation import ugettext_lazy as _
from common.utils import get_logger, get_object_or_none
from common.tasks import send_mail_async
from orgs.utils import tmp_to_org, org_aware_func
from orgs.utils import org_aware_func
from .models import Task, AdHoc

Loading…
Cancel
Save