修改默认端口获取

pull/49/head
ibuler 2016-01-26 15:37:12 +08:00
parent fe87e32e2b
commit 99f09709ec
2 changed files with 5 additions and 3 deletions

View File

@ -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 from jumpserver.api import my_render, get_object, CRYPTOR
# 设置PERM APP Log # 设置PERM APP Log
from jumpserver.settings import LOG_LEVEL from jumpserver.api import logger
logger = set_log(LOG_LEVEL, filename='jumpserver_perm.log') #logger = set_log(LOG_LEVEL, filename='jumpserver_perm.log')
@require_role('admin') @require_role('admin')

View File

@ -64,7 +64,6 @@ def get_asset_info(asset):
info = {'hostname': asset.hostname, 'ip': asset.ip} info = {'hostname': asset.hostname, 'ip': asset.ip}
if asset.use_default_auth: if asset.use_default_auth:
if default: if default:
info['port'] = int(default.field2)
info['username'] = default.field1 info['username'] = default.field1
try: try:
info['password'] = CRYPTOR.decrypt(default.field3) info['password'] = CRYPTOR.decrypt(default.field3)
@ -75,7 +74,10 @@ def get_asset_info(asset):
else: else:
info['username'] = asset.username info['username'] = asset.username
info['password'] = CRYPTOR.decrypt(asset.password) info['password'] = CRYPTOR.decrypt(asset.password)
try:
info['port'] = int(asset.port) info['port'] = int(asset.port)
except TypeError:
info['port'] = int(default.field2)
return info return info