mirror of https://github.com/jumpserver/jumpserver
fix: 命令执行 500
parent
3080bf3647
commit
ff9e470ce2
|
@ -9,11 +9,11 @@ from django.utils.translation import ugettext_lazy as _
|
|||
from django.utils.translation import ugettext
|
||||
from django.db import models
|
||||
|
||||
from terminal.models import Command
|
||||
from terminal.utils import send_command_execution_alert_mail
|
||||
from common.utils import lazyproperty
|
||||
from orgs.models import Organization
|
||||
from orgs.mixins.models import OrgModelMixin
|
||||
from orgs.utils import current_org, tmp_to_org
|
||||
from ..ansible.runner import CommandRunner
|
||||
from ..inventory import JMSInventory
|
||||
|
||||
|
@ -33,6 +33,10 @@ class CommandExecution(OrgModelMixin):
|
|||
def __str__(self):
|
||||
return self.command[:10]
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
with tmp_to_org(self.run_as.org_id):
|
||||
super().save(*args, **kwargs)
|
||||
|
||||
@property
|
||||
def inventory(self):
|
||||
if self.run_as.username_same_with_user:
|
||||
|
|
Loading…
Reference in New Issue