networktocode/network-importer

Traceback when any device in inventory has no platform

alextremblay opened this issue · 0 comments

Environment

  • Python version: 3.10
  • Network Importer version: 3.1.0

Steps to Reproduce

  1. Have a nautobot installation with at least one device that has no platform
  2. run network-importer inventory --check-connectivity against that inventory

Expected Behavior

                                          Device Inventory (limit:False)                                           
┏━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Device                  ┃ Platform   ┃ Driver                       ┃ Reachable ┃ Reason                        ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ sw1                     │ cisco-ios  │ network_importer.drivers.de… │ True      │                               │
│ sw2                     │ cisco-ios  │ network_importer.drivers.de… │ True      │                               │
│ sw3                     │ cisco-ios  │ network_importer.drivers.de… │ True      │                               │
│ sw4                     │            │ network_importer.drivers.de… │ False     │ hostname or platform not      │
│                         │            │                              │           │ defined in nautobot           │
│ sw5                     │ cisco-ios  │ network_importer.drivers.de… │ True      │                               │
└─────────────────────────┴────────────┴──────────────────────────────┴───────────┴───────────────────────────────┘

Observed Behavior

$ network-importer inventory
Traceback (most recent call last):
  File "/home/atremblay/uoft-tools/.venv/bin/network-importer", line 8, in <module>
    sys.exit(main())
  File "/home/atremblay/uoft-tools/.venv/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/atremblay/uoft-tools/.venv/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/atremblay/uoft-tools/.venv/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/atremblay/uoft-tools/.venv/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/atremblay/uoft-tools/.venv/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/atremblay/uoft-tools/.venv/lib/python3.10/site-packages/network_importer/cli.py", line 204, in inventory
    if host.is_reachable:
  File "/home/atremblay/uoft-tools/.venv/lib/python3.10/site-packages/nornir/core/inventory.py", line 368, in __getattribute__
    return object.__getattribute__(self, name)
AttributeError: 'NetworkImporterHost' object has no attribute 'is_reachable'