Handling long file names in sova

Sova writes a file with the combined failure reasons as filename.
When sova finds multiple error matches [1] this filename can be too long. This patch limits the filename to 100 chars. The full failure reasons are still written inside the file.

Example: https://storage.gra.cloud.ovh.net/v1/AUTH_dcaab5e32b234d56b626f72581e3644c/zuul_opendev_logs_a4a/798958/8/check/openstack-tox-py38/a4af6fe/job-output.txt

[1] https://opendev.org/openstack/tripleo-ci-health-queries/src/branch/master/samples/errors-testing.err - This happens specially here.
We add a sample string for each of the regex/patterns being added and run sova to verify the regexes are indeed correct.
As the number of regexes increase the filename goes out of limit.

Change-Id: I2682a7e2b9316b4c3cd11b546f35822c53a3c489
This commit is contained in:
frenzyfriday 2021-07-05 12:48:19 +02:00 committed by Ananya Banerjee
parent ed5c048f4f
commit c9358e211b
1 changed files with 1 additions and 0 deletions

View File

@ -215,6 +215,7 @@ def format_msg_filename(text):
"'",
):
text = text.replace(s, "_")
text = text[:100]
return "_" + text.rstrip("_") + ".log"