This repository has been archived by the owner on Sep 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
/
errors.py
executable file
·141 lines (119 loc) · 4.97 KB
/
errors.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#!/usr/bin/env python
# ***** BEGIN LICENSE BLOCK *****
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
# ***** END LICENSE BLOCK *****
"""Generic error lists.
Error lists are used to parse output in mozharness.base.log.OutputParser.
Each line of output is matched against each substring or regular expression
in the error list. On a match, we determine the 'level' of that line,
whether IGNORE, DEBUG, INFO, WARNING, ERROR, CRITICAL, or FATAL.
TODO: Context lines (requires work on the OutputParser side)
TODO: We could also create classes that generate these, but with the
appropriate level (please don't die on any errors; please die on any
warning; etc.) or platform or language or whatever.
"""
import re
from mozharness.base.log import WARNING, ERROR, CRITICAL, FATAL
# Exceptions
class VCSException(Exception):
pass
# ErrorLists {{{1
BaseErrorList = [
{'substr': r'''command not found''', 'level': ERROR},
]
# For ssh, scp, rsync over ssh
SSHErrorList = BaseErrorList + [
{'substr': r'''Name or service not known''', 'level': ERROR},
{'substr': r'''Could not resolve hostname''', 'level': ERROR},
{'substr': r'''POSSIBLE BREAK-IN ATTEMPT''', 'level': WARNING},
{'substr': r'''Network error:''', 'level': ERROR},
{'substr': r'''Access denied''', 'level': ERROR},
{'substr': r'''Authentication refused''', 'level': ERROR},
{'substr': r'''Out of memory''', 'level': ERROR},
{'substr': r'''Connection reset by peer''', 'level': WARNING},
{'substr': r'''Host key verification failed''', 'level': ERROR},
{'substr': r'''WARNING:''', 'level': WARNING},
{'substr': r'''rsync error:''', 'level': ERROR},
{'substr': r'''Broken pipe:''', 'level': ERROR},
{'substr': r'''Permission denied:''', 'level': ERROR},
{'substr': r'''connection unexpectedly closed''', 'level': ERROR},
{'substr': r'''Warning: Identity file''', 'level': ERROR},
{'substr': r'''command-line line 0: Missing argument''', 'level': ERROR},
]
HgErrorList = BaseErrorList + [
{'regex': re.compile(r'''^abort:'''), 'level': ERROR},
{'substr': r'''unknown exception encountered''', 'level': ERROR},
{'substr': r'''failed to import extension''', 'level': WARNING},
]
PythonErrorList = BaseErrorList + [
{'substr': r'''Traceback (most recent call last)''', 'level': ERROR},
{'substr': r'''SyntaxError: ''', 'level': ERROR},
{'substr': r'''TypeError: ''', 'level': ERROR},
{'substr': r'''NameError: ''', 'level': ERROR},
{'substr': r'''ZeroDivisionError: ''', 'level': ERROR},
{'regex': re.compile(r'''raise \w*Exception: '''), 'level': CRITICAL},
{'regex': re.compile(r'''raise \w*Error: '''), 'level': CRITICAL},
]
VirtualenvErrorList = [
{'substr': r'''not found or a compiler error:''', 'level': ERROR},
{'regex': re.compile('''\d+: error: '''), 'level': ERROR},
{'regex': re.compile('''\d+: warning: '''), 'level': WARNING},
] + PythonErrorList
# We may need to have various MakefileErrorLists for differing amounts of
# warning-ignoring-ness.
MakefileErrorList = BaseErrorList + PythonErrorList + [
{'substr': r'''No rule to make target ''', 'level': ERROR},
{'regex': re.compile(r'''akefile.*was not found\.'''), 'level': ERROR},
{'regex': re.compile(r'''Stop\.$'''), 'level': ERROR},
{'regex': re.compile(r''':\d+: error:'''), 'level': ERROR},
{'regex': re.compile(r'''make\[\d+\]: \*\*\* \[.*\] Error \d+'''), 'level': ERROR},
{'regex': re.compile(r''':\d+: warning:'''), 'level': WARNING},
{'substr': r'''Warning: ''', 'level': WARNING},
]
JarsignerErrorList = [{
'substr': r'''command not found''',
'level': FATAL
},{
'substr': r'''jarsigner error: java.lang.RuntimeException: keystore load: Keystore was tampered with, or password was incorrect''',
'level': FATAL,
'explanation': r'''The store passphrase is probably incorrect!''',
},{
'regex': re.compile(r'''jarsigner: key associated with .* not a private key'''),
'level': FATAL,
'explanation': r'''The key passphrase is probably incorrect!''',
},{
'regex': re.compile(r'''jarsigner error: java.lang.RuntimeException: keystore load: .* .No such file or directory'''),
'level': FATAL,
'explanation': r'''The keystore doesn't exist!''',
},{
'substr': r'''jarsigner: unable to open jar file:''',
'level': FATAL,
'explanation': r'''The apk is missing!''',
}]
ZipErrorList = BaseErrorList + [{
'substr': r'''zip warning:''',
'level': WARNING,
},{
'substr': r'''zip error:''',
'level': ERROR,
},{
'substr': r'''Cannot open file: it does not appear to be a valid archive''',
'level': ERROR,
}]
ZipalignErrorList = BaseErrorList + [{
'regex': re.compile(r'''Unable to open .* as a zip archive'''),
'level': ERROR,
},{
'regex': re.compile(r'''Output file .* exists'''),
'level': ERROR,
},{
'substr': r'''Input and output can't be the same file''',
'level': ERROR,
}]
# __main__ {{{1
if __name__ == '__main__':
'''TODO: unit tests.
'''
pass