Skip to content

Commit f693946

Browse files
mslocrianjleveque
authored andcommitted
sonic-utilities: Fixing traceback for show vlan brief (sonic-net#358)
* Fixing `show vlan brief` traceback Signed-off-by: Stegen Smith <[email protected]>
1 parent e3a2feb commit f693946

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

show/main.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -1232,8 +1232,14 @@ def brief(verbose):
12321232
# vlan_dhcp_helper_dict={}, vlan_ip_dict = {}, vlan_ports_dict = {}
12331233
for key in natsorted(vlan_dhcp_helper_dict.keys()):
12341234
dhcp_helpers = ','.replace(',', '\n').join(vlan_dhcp_helper_dict[key])
1235-
ip_address = ','.replace(',', '\n').join(vlan_ip_dict[key])
1236-
vlan_ports = ','.replace(',', '\n').join((vlan_ports_dict[key]))
1235+
if key not in vlan_ip_dict:
1236+
ip_address = ""
1237+
else:
1238+
ip_address = ','.replace(',', '\n').join(vlan_ip_dict[key])
1239+
if key not in vlan_ports_dict:
1240+
vlan_ports = ""
1241+
else:
1242+
vlan_ports = ','.replace(',', '\n').join((vlan_ports_dict[key]))
12371243
body.append([key, ip_address, vlan_ports, dhcp_helpers])
12381244
click.echo(tabulate(body, header, tablefmt="grid"))
12391245

0 commit comments

Comments
 (0)