r/scripting • u/bigDottee • Mar 23 '21
If you were writing a script to compare pre-change and post-change differences and wanted to have a much nicer output for IT admins to easily and quickly understand any differences that are happening.... how would you choose to display the output?
Hello All,
I am looking for some suggestions on how to handle a project that I am working on.
I have created a python script that reaches out to a specified Cisco switch, runs a bunch of commands, logging each of the responses from each command in a text file. It runs these commands twice, once as a pre-change status and again as a post-change status. Recently we just had a switch stack replaced, meaning that when looking at a unified_diff between the pre- and post-change files, the differences were significant and about 17,000 lines long.
My mentor and I were talking about a better way to display the output between changes. One thought was to generate a webpage that you could have different sections of the output collapse and expand, but even then, it doesn't seem like a great option.
If you were writing a script to compare pre-change and post-change differences and wanted to have a much nicer output for IT admins to easily and quickly understand any differences that are happening.... how would you choose to display the output?
1
u/dirty_spoon_merchant Mar 23 '21
You say the unified diff had 17000 lines, but I have to assume the actual differences are much less. I would find a way to normalize the files, by sorting or some method to always put them in the same order. Or perhaps by removing timestamps, things like that. Then you can do a diff of the normalized files and get a list of the actual differences.
1
u/jedberg Mar 23 '21
What is your actual goal? Why do you need to see these diffs? What sort of actionable information are you trying to get from these reports?