Skip to content

Commit

Permalink
[openvswitch] catch cases when 'ovs-vsctl list bridge' has no output
Browse files Browse the repository at this point in the history
If ovs_list_bridge_cmd does not return a valuable output, br_protos
variable won't be assigned before we reference it.

Fix that by assigning an empty list to br_protos .

Resolves: #2249

Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
  • Loading branch information
pmoravec authored and TurboTurtle committed Oct 1, 2020
1 parent c585421 commit a3bfeaa
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions sos/report/plugins/openvswitch.py
Expand Up @@ -219,6 +219,7 @@ def setup(self):
ovs_list_bridge_cmd = "ovs-vsctl -t 5 list bridge %s" % br
br_info = self.collect_cmd_output(ovs_list_bridge_cmd)

br_protos = []
for line in br_info['output'].splitlines():
if "protocols" in line:
br_protos_ln = line[line.find("[")+1:line.find("]")]
Expand Down

0 comments on commit a3bfeaa

Please sign in to comment.