Commit 2a51eeef authored by 老广's avatar 老广 Committed by GitHub

Update connect.py

parent 4b593e56
...@@ -522,8 +522,12 @@ class Nav(object): ...@@ -522,8 +522,12 @@ class Nav(object):
asset_info = get_asset_info(asset) asset_info = get_asset_info(asset)
# 获取该资产包含的角色 # 获取该资产包含的角色
role = [str(role.name) for role in self.user_perm.get('asset').get(asset).get('role')] role = [str(role.name) for role in self.user_perm.get('asset').get(asset).get('role')]
try:
print line % (index, asset.ip, asset_info.get('port'), print line % (index, asset.ip, asset_info.get('port'),
self.truncate_str(asset.hostname), str(role).replace("'", ''), asset.comment) self.truncate_str(asset.hostname), str(role).replace("'", ''), asset.comment)
except:
print line % (index, asset.ip, asset_info.get('port'),
self.truncate_str(asset.hostname), str(role).replace("'", ''), '')
print print
def try_connect(self): def try_connect(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment