Clean up iosxr get_config_diff function (#57589)

This fixes an index error issue when running tests on zuul.ansible.com
for iosxr. We can fix this by getting the last element in the list.

Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2019-06-14 05:36:22 -04:00 committed by Nilashish Chakraborty
parent af25274d6a
commit 88a1fc28d8

View file

@ -345,8 +345,8 @@ def get_config_diff(module, running=None, candidate=None):
return response
elif is_netconf(module):
if running and candidate:
running_data = running.split("\n", 1)[1].rsplit("\n", 1)[0]
candidate_data = candidate.split("\n", 1)[1].rsplit("\n", 1)[0]
running_data = running.split("\n", 1)[-1].rsplit("\n", 1)[0]
candidate_data = candidate.split("\n", 1)[-1].rsplit("\n", 1)[0]
if running_data != candidate_data:
d = Differ()
diff = list(d.compare(running_data.splitlines(), candidate_data.splitlines()))