davidban77 / gns3fy

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

No proper error show when Node is not found #90

Open davidban77 opened 4 years ago

davidban77 commented 4 years ago

Trying to retrieve the in the following manner does not provide a clear NOT FOUND error:

In [31]: cloud2 = Node(name="Cloud2", project_id=prj.project_id, connector=gns3_server)

In [32]: try:
    ...:     cloud2.get()
    ...: except:
    ...:     console.print_exception()
    ...:
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ <ipython-input-32-0e5e4b055f2c>:2 in <module>                                                    │
│                                                                                                  │
│ /Users/netpanda/miniconda3/envs/labify/lib/python3.8/site-packages/gns3fy/gns3fy.py:509 in       │
│ wrapper                                                                                          │
│                                                                                                  │
│    506 │   │   │   │   │   raise ValueError(                                                     │
│    507 │   │   │   │   │   │   "Multiple nodes found with same name. Need to submit node_id"     │
│    508 │   │   │   │   │   )                                                                     │
│ ❱  509 │   │   │   │   self.node_id = extracted[0]["node_id"]                                    │
│    510 │   │   # Checks for Link                                                                 │
│    511 │   │   if self.__class__.__name__ == "Link":                                             │
│    512 │   │   │   if not self.link_id:                                                          │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
IndexError: list index out of range