From 99f09709ec6a4252d85e17b7b1d3ae00a20edbb1 Mon Sep 17 00:00:00 2001 From: ibuler Date: Tue, 26 Jan 2016 15:37:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=BB=98=E8=AE=A4=E7=AB=AF?= =?UTF-8?q?=E5=8F=A3=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jperm/views.py | 4 ++-- jumpserver/api.py | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/jperm/views.py b/jperm/views.py index 5e7707394..a8a66128b 100644 --- a/jperm/views.py +++ b/jperm/views.py @@ -16,8 +16,8 @@ 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.settings import LOG_LEVEL -logger = set_log(LOG_LEVEL, filename='jumpserver_perm.log') +from jumpserver.api import logger +#logger = set_log(LOG_LEVEL, filename='jumpserver_perm.log') @require_role('admin') diff --git a/jumpserver/api.py b/jumpserver/api.py index 238906537..691aafb11 100644 --- a/jumpserver/api.py +++ b/jumpserver/api.py @@ -64,7 +64,6 @@ def get_asset_info(asset): info = {'hostname': asset.hostname, 'ip': asset.ip} if asset.use_default_auth: if default: - info['port'] = int(default.field2) info['username'] = default.field1 try: info['password'] = CRYPTOR.decrypt(default.field3) @@ -75,7 +74,10 @@ def get_asset_info(asset): else: info['username'] = asset.username info['password'] = CRYPTOR.decrypt(asset.password) + try: info['port'] = int(asset.port) + except TypeError: + info['port'] = int(default.field2) return info