ce_snmp_location: fix for out of array index. (#57903)

pull/58481/head
YuandongXu 5 years ago committed by René Moser
parent 19c6448459
commit afe7cd3fda

@ -0,0 +1,3 @@
---
bugfixes:
- fix bug - out of array index.There should be a judgement about array length before the value of the array is taken out.

@ -171,8 +171,9 @@ class SnmpLocation(object):
tmp_cfg = self.cli_get_config()
if tmp_cfg:
temp_data = tmp_cfg.split(r"location ")
self.cur_cfg["location"] = temp_data[1]
self.existing["location"] = temp_data[1]
if len(temp_data) > 1:
self.cur_cfg["location"] = temp_data[1]
self.existing["location"] = temp_data[1]
def get_end_state(self):
""" Get end state """
@ -180,7 +181,8 @@ class SnmpLocation(object):
tmp_cfg = self.cli_get_config()
if tmp_cfg:
temp_data = tmp_cfg.split(r"location ")
self.end_state["location"] = temp_data[1]
if len(temp_data) > 1:
self.end_state["location"] = temp_data[1]
def cli_load_config(self, commands):
""" Load config by cli """

Loading…
Cancel
Save