1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-29 02:08:10 +00:00

Fix naming of node with a number in the name

Fix #1149
This commit is contained in:
Julien Duponchelle 2017-07-27 16:06:52 +02:00
parent fc6b6b5e63
commit 283b08c2a1
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8
2 changed files with 5 additions and 1 deletions

View File

@ -368,7 +368,8 @@ class Project:
if base_name is None:
return None
base_name = re.sub(r"[ ]", "", base_name)
base_name = re.sub(r"[0-9]+$", "{0}", base_name)
if base_name in self._allocated_node_names:
base_name = re.sub(r"[0-9]+$", "{0}", base_name)
if '{0}' in base_name or '{id}' in base_name:
# base name is a template, replace {0} or {id} by an unique identifier

View File

@ -602,6 +602,9 @@ def test_node_name(project, async_run):
node = async_run(project.add_node(compute, "VPCS-1", None, node_type="vpcs", properties={"startup_config": "test.cfg"}))
assert node.name == "VPCS-2"
node = async_run(project.add_node(compute, "R3", None, node_type="vpcs", properties={"startup_config": "test.cfg"}))
assert node.name == "R3"
def test_add_iou_node_and_check_if_gets_application_id(project, async_run):
compute = MagicMock()