[Minor] Traceback when requesting merge-test that includes snmpinfo.<oid_object_name>
kbarton1212 opened this issue · comments
Hi,
Thanks again for making the necessary changes from my previous request and implementing snmpoid's into the template. They are running great!
Although very minor, when ever I have snmpinfo.<oid_object_name> variables in my template, I am unable to successfully run the ztp request merge-test <keystore_id_name>
[kb@freeztp ~]$ ztp request merge-test 9300
Unable to log to logfile /etc/ztp/ztp.log. Make sure FreeZTP is installed. Disabling logging to logfile
2019-07-31 13:15:42: cfact.get_keystore_id: Checking Keystores and IDArrays for (9300)
2019-07-31 13:15:42: cfact.get_keystore_id: ID (9300) resolved directly to a keystore
2019-07-31 13:15:42: cfact.get_template: Looking up association for identity (9300)
2019-07-31 13:15:42: cfact.get_template: Found associated template (9300-TEMPLATE)
2019-07-31 13:15:42: cfact.get_template: Template (9300-TEMPLATE) exists in local config. Returning
Some variables in jinja template do not exist in keystore:
-range
-snmpinfo
2019-07-31 13:15:42: cfact.pull_keystore_values: Inserting IDArray keys
2019-07-31 13:15:42: cfact.merge_test: Merging with values:
{
"idarray_8": "C9300-48UN",
"idarray_9": "C9300-48UXM",
"Mgmt_IP": "dhcp",
"idarray_2": "C9300-24T",
"idarray_3": "C9300-24U",
"idarray_1": "C9300-24P",
"idarray_6": "C9300-48T",
"idarray_7": "C9300-48U",
"idarray_4": "C9300-24UX",
"idarray_5": "C9300-48P",
"idarray": [
"C9300-24P",
"C9300-24T",
"C9300-24U",
"C9300-24UX",
"C9300-48P",
"C9300-48T",
"C9300-48U",
"C9300-48UN",
"C9300-48UXM"
]
}
##############################
Traceback (most recent call last):
File "/usr/bin/ztp", line 3943, in <module>
interpreter()
File "/usr/bin/ztp", line 3766, in interpreter
cfact.merge_test(sys.argv[3], "final")
File "/usr/bin/ztp", line 653, in merge_test
console(j2template.render(kvalues))
File "/usr/lib64/python2.7/site-packages/jinja2/environment.py", line 1008, in render
return self.environment.handle_exception(exc_info, True)
File "/usr/lib64/python2.7/site-packages/jinja2/environment.py", line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File "<template>", line 1, in top-level template code
File "/usr/lib64/python2.7/site-packages/jinja2/environment.py", line 430, in getattr
return getattr(obj, attribute)
jinja2.exceptions.UndefinedError: 'snmpinfo' is undefined
[kb@freeztp ~]$
Yea this makes sense. I will see if I can get v1.3.1 out in the next couple days to fix this.