mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-01-18 02:39:45 +00:00
Fix dynamips node creation error
This commit is contained in:
parent
5c5caf8418
commit
e9fef928b0
@ -98,7 +98,8 @@ class Node:
|
|||||||
log.critical("Can't set attribute %s", prop)
|
log.critical("Can't set attribute %s", prop)
|
||||||
raise e
|
raise e
|
||||||
else:
|
else:
|
||||||
self.properties[prop] = kwargs[prop]
|
if prop not in self.CONTROLLER_ONLY_PROPERTIES and kwargs[prop] is not None and kwargs[prop] != "":
|
||||||
|
self.properties[prop] = kwargs[prop]
|
||||||
|
|
||||||
if self._symbol is None:
|
if self._symbol is None:
|
||||||
self.symbol = ":/symbols/computer.svg"
|
self.symbol = ":/symbols/computer.svg"
|
||||||
|
@ -83,7 +83,7 @@ def test_name(compute, project):
|
|||||||
|
|
||||||
def test_vmname(compute, project):
|
def test_vmname(compute, project):
|
||||||
"""
|
"""
|
||||||
Additionnal properties should add to the properties
|
Additionnal properties should be add to the properties
|
||||||
field
|
field
|
||||||
"""
|
"""
|
||||||
node = Node(project, compute, "PC",
|
node = Node(project, compute, "PC",
|
||||||
@ -93,6 +93,23 @@ def test_vmname(compute, project):
|
|||||||
assert node.properties["vmname"] == "test"
|
assert node.properties["vmname"] == "test"
|
||||||
|
|
||||||
|
|
||||||
|
def test_empty_properties(compute, project):
|
||||||
|
"""
|
||||||
|
Empty properties need to be ignored
|
||||||
|
"""
|
||||||
|
node = Node(project, compute, "PC",
|
||||||
|
node_id=str(uuid.uuid4()),
|
||||||
|
node_type="virtualbox",
|
||||||
|
aa="",
|
||||||
|
bb=None,
|
||||||
|
category=2,
|
||||||
|
cc="xx")
|
||||||
|
assert "aa" not in node.properties
|
||||||
|
assert "bb" not in node.properties
|
||||||
|
assert "cc" in node.properties
|
||||||
|
assert "category" not in node.properties # Controller only
|
||||||
|
|
||||||
|
|
||||||
def test_eq(compute, project, node, controller):
|
def test_eq(compute, project, node, controller):
|
||||||
assert node == Node(project, compute, "demo1", node_id=node.id, node_type="qemu")
|
assert node == Node(project, compute, "demo1", node_id=node.id, node_type="qemu")
|
||||||
assert node != "a"
|
assert node != "a"
|
||||||
|
Loading…
Reference in New Issue
Block a user