ce_snmp_location: fix for out of array index. (#57903)
(cherry picked from commit afe7cd3fda
)
This commit is contained in:
parent
aee18ffc27
commit
959c07fc5c
2 changed files with 8 additions and 3 deletions
|
@ -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,6 +171,7 @@ class SnmpLocation(object):
|
||||||
tmp_cfg = self.cli_get_config()
|
tmp_cfg = self.cli_get_config()
|
||||||
if tmp_cfg:
|
if tmp_cfg:
|
||||||
temp_data = tmp_cfg.split(r"location ")
|
temp_data = tmp_cfg.split(r"location ")
|
||||||
|
if len(temp_data) > 1:
|
||||||
self.cur_cfg["location"] = temp_data[1]
|
self.cur_cfg["location"] = temp_data[1]
|
||||||
self.existing["location"] = temp_data[1]
|
self.existing["location"] = temp_data[1]
|
||||||
|
|
||||||
|
@ -180,6 +181,7 @@ class SnmpLocation(object):
|
||||||
tmp_cfg = self.cli_get_config()
|
tmp_cfg = self.cli_get_config()
|
||||||
if tmp_cfg:
|
if tmp_cfg:
|
||||||
temp_data = tmp_cfg.split(r"location ")
|
temp_data = tmp_cfg.split(r"location ")
|
||||||
|
if len(temp_data) > 1:
|
||||||
self.end_state["location"] = temp_data[1]
|
self.end_state["location"] = temp_data[1]
|
||||||
|
|
||||||
def cli_load_config(self, commands):
|
def cli_load_config(self, commands):
|
||||||
|
|
Loading…
Reference in a new issue