mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-28 03:08:14 +00:00
Use uuid4() for temporary node name while duplicating a node.
This commit is contained in:
parent
0854c04687
commit
47e8392ceb
@ -282,7 +282,7 @@ class BaseManager:
|
|||||||
# We force a refresh of the name. This force the rewrite
|
# We force a refresh of the name. This force the rewrite
|
||||||
# of some configuration files
|
# of some configuration files
|
||||||
node_name = destination_node.name
|
node_name = destination_node.name
|
||||||
destination_node.name = node_name + "tmp"
|
destination_node.name = node_name + str(uuid4())
|
||||||
destination_node.name = node_name
|
destination_node.name = node_name
|
||||||
|
|
||||||
return destination_node
|
return destination_node
|
||||||
|
@ -614,7 +614,7 @@ class Dynamips(BaseManager):
|
|||||||
source_node = self.get_node(source_node_id)
|
source_node = self.get_node(source_node_id)
|
||||||
destination_node = self.get_node(destination_node_id)
|
destination_node = self.get_node(destination_node_id)
|
||||||
|
|
||||||
# Non router gears
|
# Not a Dynamips router
|
||||||
if not hasattr(source_node, "startup_config_path"):
|
if not hasattr(source_node, "startup_config_path"):
|
||||||
return (yield from super().duplicate_node(source_node_id, destination_node_id))
|
return (yield from super().duplicate_node(source_node_id, destination_node_id))
|
||||||
|
|
||||||
|
@ -897,7 +897,7 @@ class Project:
|
|||||||
:returns: New node
|
:returns: New node
|
||||||
"""
|
"""
|
||||||
if node.status != "stopped" and not node.is_always_running():
|
if node.status != "stopped" and not node.is_always_running():
|
||||||
raise aiohttp.web.HTTPConflict(text="Can't duplicate node data while is running")
|
raise aiohttp.web.HTTPConflict(text="Cannot duplicate node data while the node is running")
|
||||||
|
|
||||||
data = copy.deepcopy(node.__json__(topology_dump=True))
|
data = copy.deepcopy(node.__json__(topology_dump=True))
|
||||||
# Some properties like internal ID should not be duplicate
|
# Some properties like internal ID should not be duplicate
|
||||||
@ -927,7 +927,7 @@ class Project:
|
|||||||
})
|
})
|
||||||
except aiohttp.web.HTTPNotFound as e:
|
except aiohttp.web.HTTPNotFound as e:
|
||||||
yield from self.delete_node(new_node_uuid)
|
yield from self.delete_node(new_node_uuid)
|
||||||
raise aiohttp.web.HTTPConflict(text="You can't duplicate this node type")
|
raise aiohttp.web.HTTPConflict(text="This node type cannot be duplicated")
|
||||||
except aiohttp.web.HTTPConflict as e:
|
except aiohttp.web.HTTPConflict as e:
|
||||||
yield from self.delete_node(new_node_uuid)
|
yield from self.delete_node(new_node_uuid)
|
||||||
raise e
|
raise e
|
||||||
|
Loading…
Reference in New Issue
Block a user