[chassis] Fix uninitialized variable in minigraph parsing (#8917)
Why I did it Local variable may not be created in minigraph parsing, causing crash How I did it Moved variable creation earlier
This commit is contained in:
parent
46bcda359c
commit
7ebe44a2a0
@ -966,6 +966,7 @@ def parse_asic_meta(meta, hname):
|
|||||||
def parse_deviceinfo(meta, hwsku):
|
def parse_deviceinfo(meta, hwsku):
|
||||||
port_speeds = {}
|
port_speeds = {}
|
||||||
port_descriptions = {}
|
port_descriptions = {}
|
||||||
|
sys_ports = {}
|
||||||
for device_info in meta.findall(str(QName(ns, "DeviceInfo"))):
|
for device_info in meta.findall(str(QName(ns, "DeviceInfo"))):
|
||||||
dev_sku = device_info.find(str(QName(ns, "HwSku"))).text
|
dev_sku = device_info.find(str(QName(ns, "HwSku"))).text
|
||||||
if dev_sku == hwsku:
|
if dev_sku == hwsku:
|
||||||
@ -980,7 +981,6 @@ def parse_deviceinfo(meta, hwsku):
|
|||||||
port_speeds[port_alias_map.get(alias, alias)] = speed
|
port_speeds[port_alias_map.get(alias, alias)] = speed
|
||||||
|
|
||||||
sysports = device_info.find(str(QName(ns, "SystemPorts")))
|
sysports = device_info.find(str(QName(ns, "SystemPorts")))
|
||||||
sys_ports = {}
|
|
||||||
if sysports is not None:
|
if sysports is not None:
|
||||||
for sysport in sysports.findall(str(QName(ns, "SystemPort"))):
|
for sysport in sysports.findall(str(QName(ns, "SystemPort"))):
|
||||||
portname = sysport.find(str(QName(ns, "Name"))).text
|
portname = sysport.find(str(QName(ns, "Name"))).text
|
||||||
|
Loading…
Reference in New Issue
Block a user