mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-13 05:49:07 +00:00
[Fix] ops.models.adhoc (#4096)
This commit is contained in:
@@ -128,13 +128,15 @@ class Task(PeriodTaskModelMixin, OrgModelMixin):
|
|||||||
|
|
||||||
def _last_adhocexecution(self, is_success, key):
|
def _last_adhocexecution(self, is_success, key):
|
||||||
obj = AdHocExecution.objects.filter(task_id=self.id, is_success=is_success).order_by('-date_finished').first()
|
obj = AdHocExecution.objects.filter(task_id=self.id, is_success=is_success).order_by('-date_finished').first()
|
||||||
body = obj.summary.get(key)
|
body = obj.summary and obj.summary.get(key)
|
||||||
|
|
||||||
if body:
|
if body:
|
||||||
asset, body = body.popitem()
|
asset, body = body.popitem()
|
||||||
action, body = body.popitem()
|
if body:
|
||||||
return asset, action, body.get('msg', '')
|
action, body = body.popitem()
|
||||||
else:
|
return asset, action, (body or '') and body.get('msg', '')
|
||||||
return '', '', ''
|
return asset, '', ''
|
||||||
|
return '', '', ''
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name + '@' + str(self.org_id)
|
return self.name + '@' + str(self.org_id)
|
||||||
|
Reference in New Issue
Block a user