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>
pull/57845/head
Paul Belanger 6 years ago committed by Nilashish Chakraborty
parent af25274d6a
commit 88a1fc28d8

@ -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()))

Loading…
Cancel
Save