aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools
diff options
context:
space:
mode:
Diffstat (limited to 'resources/tools')
-rw-r--r--resources/tools/presentation/generator_alerts.py34
1 files changed, 33 insertions, 1 deletions
diff --git a/resources/tools/presentation/generator_alerts.py b/resources/tools/presentation/generator_alerts.py
index d22e7aa963..c3bf81d7ff 100644
--- a/resources/tools/presentation/generator_alerts.py
+++ b/resources/tools/presentation/generator_alerts.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2021 Cisco and/or its affiliates.
+# Copyright (c) 2022 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
@@ -279,6 +279,38 @@ class Alerting:
line, error_msg = line[:-1].split(u'###', maxsplit=1)
test = line.split(u'-')
name = u'-'.join(test[3:-1])
+ if len(error_msg) > 128:
+ if u";" in error_msg[128:256]:
+ error_msg = \
+ f"{error_msg[:128]}" \
+ f"{error_msg[128:].split(u';', 1)[0]}..."
+ elif u":" in error_msg[128:256]:
+ error_msg = \
+ f"{error_msg[:128]}" \
+ f"{error_msg[128:].split(u':', 1)[0]}..."
+ elif u"." in error_msg[128:256]:
+ error_msg = \
+ f"{error_msg[:128]}" \
+ f"{error_msg[128:].split(u'.', 1)[0]}..."
+ elif u"?" in error_msg[128:256]:
+ error_msg = \
+ f"{error_msg[:128]}" \
+ f"{error_msg[128:].split(u'?', 1)[0]}..."
+ elif u"!" in error_msg[128:256]:
+ error_msg = \
+ f"{error_msg[:128]}" \
+ f"{error_msg[128:].split(u'!', 1)[0]}..."
+ elif u"," in error_msg[128:256]:
+ error_msg = \
+ f"{error_msg[:128]}" \
+ f"{error_msg[128:].split(u',', 1)[0]}..."
+ elif u" " in error_msg[128:256]:
+ error_msg = \
+ f"{error_msg[:128]}" \
+ f"{error_msg[128:].split(u' ', 1)[0]}..."
+ else:
+ error_msg = error_msg[:128]
+
except ValueError:
continue