Skip to content

Commit

Permalink
bird 2: do not crash on lines with a single unhandled keyword
Browse files Browse the repository at this point in the history
  • Loading branch information
liske committed Aug 7, 2023
1 parent 662b16b commit d6c0491
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bird/lib/check_mk/base/plugins/agent_based/bird.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,17 +191,17 @@ def parse_bird(string_table):
last_protocol['description'] = " ".join(line[2:])
if line[1] == "Preference:":
last_protocol['preference'] = line[2]
elif line[2] == "filter:":
elif len(line) > 2 and line[2] == "filter:":
key = _bird_x_to_key(line[1:3])
last_protocol[key] = " ".join(line[3:])
elif line[2] == "limit:" and line[1] != 'Route':
elif len(line) > 2 and line[2] == "limit:" and line[1] != 'Route':
limits = last_protocol.setdefault('limits', {})
last_limit = limits[line[1]] = {}
last_limit['value'] = int(line[3])
last_limit['hit'] = (len(line) >= 5 and line[4] == "[HIT]")
elif line[1] == "Action:":
last_limit['action'] = line[2]
elif line[2] == "limit:" and line[1] == 'Route': # legacy "route limit" option
elif len(line) > 2 and line[2] == "limit:" and line[1] == 'Route': # legacy "route limit" option
limits = last_protocol.setdefault('limits', {})
if 'Import' in limits:
continue # ignore in case we already have a import limit
Expand Down

0 comments on commit d6c0491

Please sign in to comment.