PackeTsar / freeztp

An Open-Source Zero-Touch Provisioning System for Cisco IOS.
GNU General Public License v3.0
216 stars 27 forks source link

dev1.1.0g // Bad csv format breaks 'ztp' commands #26

Closed derek-shnosh closed 5 years ago

derek-shnosh commented 6 years ago

Received the following traceback when my keystore_id rows had more delimiters than the header row.

root@freeztp-dev:/etc/ztp/sis# ztp request external-keystore-test SBS 
Traceback (most recent call last):
  File "/bin/ztp", line 3511, in <module>
    interpreter()
  File "/bin/ztp", line 3058, in interpreter
    config.load_external()
  File "/bin/ztp", line 668, in load_external
    external_keystores.load()
  File "/bin/ztp", line 2992, in load
    if key[:7] == "idarray":
TypeError: 'NoneType' object has no attribute '__getitem__'

All ZTP commands gave the same traceback until the csv format was fixed.

icovada commented 6 years ago

Sounds like it's doing exactly what it's supposed to.

derek-shnosh commented 6 years ago

@icovada of course; but from what I understand, error handling should be implemented to adhere to development best practices; so the end user is provided with a simplistic error message. Which would prevent the end user from having to seek assistance; i.e. "Missing in external CSV" is easier to decipher and take action than a traceback.

@PackeTsar has done an excellent job all around with FreeZTP. I created the issue to bring the traceback to his attention, not so much to seek assistance with the error.

PackeTsar commented 5 years ago

Added bug to tracker issue