davidban77 / gns3fy

Python library wrapper around GNS3 Server REST API
https://davidban77.github.io/gns3fy/
57 stars 28 forks source link

Improve error message when creating a node an the template is missing #26

Closed davidban77 closed 5 years ago

davidban77 commented 5 years ago

At the moment the check goes up to the point of collecting the properties

In [9]: lab.create_node(name="rte1", node_type="qemu", template="isco NX-OSv 9000 7.0.3.I7.6")
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-9-fa8fcb775416> in <module>
----> 1 lab.create_node(name="rte1", node_type="qemu", template="isco NX-OSv 9000 7.0.3.I7.6")

~/projects/gns3fy/gns3fy/gns3fy.py in create_node(self, name, **kwargs)
   1449             project_id=self.project_id, connector=self.connector, name=name, **kwargs
   1450         )
-> 1451         _node.create()
   1452         self.nodes.append(_node)
   1453         print(

~/projects/gns3fy/gns3fy/gns3fy.py in create(self, extra_properties)
    818         ):
    819             try:
--> 820                 _properties.pop(_field)
    821             except KeyError:
    822                 continue

AttributeError: 'NoneType' object has no attribute 'pop'

A check of the template should be in place