PackeTsar / freeztp

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

IDArray pointing to non-existent keystore fails ZTP #56

Closed PackeTsar closed 4 years ago

PackeTsar commented 5 years ago

If an IDArray exists, but its referenced keystore does not, ZTP will throw an exception like below

[root@ZTP_SERVER ~]# ztp request merge-test SERIALNUMBER 
2019-10-10 14:51:49:   cfact.get_keystore_id: Checking Keystores and IDArrays for (SERIALNUMBER)

2019-10-10 14:51:49:   cfact.get_keystore_id: Checking Keystore names for (SERIALNUMBER)

2019-10-10 14:51:49:   cfact.get_keystore_id: ID (SERIALNUMBER) not found in keystore names, checking local IDArrays

2019-10-10 14:51:49:   cfact.get_keystore_id: ID 'SERIALNUMBER' resolved to arrayname 'NON_EXISTENT_KEYSTORE_NAME'

2019-10-10 14:51:49:   cfact.get_template: Looking up association for identity (NON_EXISTENT_KEYSTORE_NAME)

2019-10-10 14:51:49:   cfact.get_template: Default-template is pointing to (DEFAULT_TEMPLATE)

2019-10-10 14:51:49:   cfact.get_template: Template (DEFAULT_TEMPLATE) exists in local config. Returning

Traceback (most recent call last):
  File "/usr/bin/ztp", line 3993, in <module>
    interpreter()
  File "/usr/bin/ztp", line 3816, in interpreter
    cfact.merge_test(sys.argv[3], "final")
  File "/usr/bin/ztp", line 656, in merge_test
    if var not in path["keyvalstore"][identity]:
KeyError: u'NON_EXISTENT_KEYSTORE_NAME'