summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2025-07-20 12:01:22 -0500
committerJohn Estabrook <jestabro@vyos.io>2025-07-20 12:01:22 -0500
commit400a94ab1a94c18067642cd281e8bfde48c25d40 (patch)
tree02e2b378e1d1ae3ae04149d3d61425ffa75c7a73 /python
parent3b60a5e8d334cf3e8bc04ae61500ffa420b183b6 (diff)
downloadvyos-1x-400a94ab1a94c18067642cd281e8bfde48c25d40.tar.gz
vyos-1x-400a94ab1a94c18067642cd281e8bfde48c25d40.zip
T6704: limit size of noteworthy list in airbag
Use deque instead of list to limit the size of collected stderr messages in airbag.
Diffstat (limited to 'python')
-rw-r--r--python/vyos/airbag.py6
-rw-r--r--python/vyos/defaults.py2
2 files changed, 6 insertions, 2 deletions
diff --git a/python/vyos/airbag.py b/python/vyos/airbag.py
index a869daae8..1dcccdd47 100644
--- a/python/vyos/airbag.py
+++ b/python/vyos/airbag.py
@@ -15,10 +15,12 @@
import sys
from datetime import datetime
+from collections import deque
from vyos import debug
from vyos.logger import syslog
from vyos.version import get_full_version_data
+from vyos.defaults import airbag_noteworthy_size
def enable(log=True):
@@ -27,7 +29,7 @@ def enable(log=True):
_intercepting_exceptions()
-_noteworthy = []
+_noteworthy = deque(maxlen=airbag_noteworthy_size)
def noteworthy(msg):
@@ -72,7 +74,7 @@ def bug_report(dtype, value, trace):
note = ''
if _noteworthy:
note = 'noteworthy:\n'
- note += '\n'.join(_noteworthy)
+ note += '\n'.join(list(_noteworthy))
information.update({
'date': datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
diff --git a/python/vyos/defaults.py b/python/vyos/defaults.py
index fbb5a0393..5e3ba4e63 100644
--- a/python/vyos/defaults.py
+++ b/python/vyos/defaults.py
@@ -88,3 +88,5 @@ DEFAULT_COMMIT_CONFIRM_MINUTES = 10
commit_hooks = {'pre': '/etc/commit/pre-hooks.d',
'post': '/etc/commit/post-hooks.d'
}
+
+airbag_noteworthy_size = 20