Skip to content

Commit e0b796d

Browse files
bhouse-nexthopgshemesh2
authored andcommitted
monit service parsing needs to handle multi-line data (sonic-net#18045)
In some circumstances monit can return multiline data for a value for a service, such as: This patch adds handling for ignoring multi-line output since no tests rely on it. Signed-off-by: Brad House <bhouse@nexthop.ai> Signed-off-by: Guy Shemesh <gshemesh@nvidia.com>
1 parent f87660d commit e0b796d

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

tests/memory_checker/test_memory_checker.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,12 @@ def parse_monit_output(lines):
157157
continue
158158
if service is None:
159159
continue
160+
161+
# Ignore line continuations that start with more than 2 whitespace
162+
# characters. We don't need the data at all.
163+
if len(line) - len(line.lstrip()) > 2:
164+
continue
165+
160166
if line.startswith(' '):
161167
key, value = line.lstrip().split(' ', 1)
162168
service[key.replace(' ', '_')] = value.lstrip()

0 commit comments

Comments
 (0)