diff --git a/jperm/views.py b/jperm/views.py index f546079c2..a8941af30 100644 --- a/jperm/views.py +++ b/jperm/views.py @@ -4,6 +4,7 @@ from __future__ import unicode_literals from django.db.models import Q from django.http import HttpResponseBadRequest, HttpResponseNotAllowed from paramiko import SSHException +from collections import OrderedDict from jperm.perm_api import * from juser.models import User, UserGroup @@ -16,6 +17,7 @@ from jperm.ansible_api import MyTask from jperm.perm_api import get_role_info, get_role_push_host from jumpserver.api import my_render, get_object, CRYPTOR + # 设置PERM APP Log from jumpserver.api import logger #logger = set_log(LOG_LEVEL, filename='jumpserver_perm.log') @@ -416,6 +418,7 @@ def perm_role_detail(request): users = role_info.get("users") user_groups = role_info.get("user_groups") pushed_asset, need_push_asset = get_role_push_host(get_object(PermRole, id=role_id)) + except ServerError, e: logger.warning(e) diff --git a/templates/jperm/perm_role_detail.html b/templates/jperm/perm_role_detail.html index ad21cc928..168fb2adf 100644 --- a/templates/jperm/perm_role_detail.html +++ b/templates/jperm/perm_role_detail.html @@ -30,13 +30,15 @@
时间 | -名称 | +
时间 | +名称 | {% for rule in rules %}||
{{ rule.date_added | date:"Y-m-d H:i:s"}} | -{{ rule.name }} | +{{ rule.date_added | date:"Y-m-d H:i:s" }} | +{{ rule.name }} + |
用户 | -用户组 | -||||||||
-
|
主机 | 主机组 | ||||
|
|
+ + | +主机 | +密钥 | +结果 | +操作 | +|
---|---|---|---|---|---|
+ + | +{{ asset.hostname }} | +{{ info.key | yesno:"是,否,未知" }} | + {% if info.success %} +{{ info.success | yesno:"成功,失败,未知" }} | + {% else %} +{{ info.success | yesno:"成功,失败,未知" }} | + {% endif %} ++ |
- - | -主机 | -密钥 | -密码 | -结果 | -操作 | -
---|---|---|---|---|---|
+ + | +主机 | +密钥 | +结果 | +操作 | +{{ asset.hostname }} | {{ info.key | yesno:"是,否,未知" }} | -{{ info.password | yesno:"是,否,未知" }} | {% if info.success %} -{{ info.success | yesno:"成功,失败,未知" }} | +{{ info.success | yesno:"成功,失败,未知" }} | {% else %} -{{ info.success | yesno:"成功,失败,未知" }} | +{{ info.success | yesno:"成功,失败,未知" }} | {% endif %} -+ | + + + | {% endfor %} @@ -215,9 +289,7 @@ - -
- - | -主机 | -IP | -
---|---|---|
+ + | +主机 | +IP | +