Unverified Commit 97d80e61 authored by 老广's avatar 老广 Committed by GitHub

Merge pull request #249 from jumpserver/dev

[Bugfix] 修复添加节点的错误
parents 3c7a6b42 25a447dd
......@@ -9,6 +9,7 @@ import os
import math
import time
from treelib import Tree
from treelib.exceptions import NodeIDAbsentError
from . import char
from .conf import config
......@@ -386,7 +387,10 @@ class InteractiveServer:
tag = "{}.{}({})".format(index+1, node.name, node.assets_amount)
key = node.key
parent_key = key[:node.key.rfind(':')] or root
self.node_tree.create_node(tag=tag, identifier=key, data=node, parent=parent_key)
try:
self.node_tree.create_node(tag=tag, identifier=key, data=node, parent=parent_key)
except NodeIDAbsentError:
self.node_tree.create_node(tag=tag, identifier=key, data=node, parent=root)
def display_nodes_as_tree(self):
if self.nodes is None:
......
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