View | Details | Raw Unified | Return to bug 30751
Collapse All | Expand All

(-)a/branches/ucs-3.2/ucs-3.2-3/test/ucs-test/tests/00_base/99check_log_files (-25 / +17 lines)
 Lines 14-20   from sys import exit Link Here 
14
14
15
from univention.management.console.modules.setup.setup_script import Profile
15
from univention.management.console.modules.setup.setup_script import Profile
16
import univention.testing.utils as utils
16
import univention.testing.utils as utils
17
import check_log_files_definitions as definitions
17
from check_log_files_definitions import Errors, Tracebacks, Warnings
18
18
19
19
20
class CheckLogFiles(object):
20
class CheckLogFiles(object):
 Lines 23-30   class CheckLogFiles(object): Link Here 
23
        """
23
        """
24
        Test constructor
24
        Test constructor
25
        """
25
        """
26
        self.DefinitionsErrors = definitions.Errors
26
        self.errors = Errors()
27
        self.DefinitionsWarnings = definitions.Warnings
27
        self.warnings = Warnings()
28
        self.tracebacks = Tracebacks()
28
29
29
        self.log_file = ''
30
        self.log_file = ''
30
        self.line_counter = 0
31
        self.line_counter = 0
 Lines 48-55   class CheckLogFiles(object): Link Here 
48
            self.line_counter += 1
49
            self.line_counter += 1
49
            trace_line += 1
50
            trace_line += 1
50
51
51
            if (trace_line >= self.max_trace_lines or re.match('.*Error: .*',
52
            if trace_line >= self.max_trace_lines or 'Error: ' in line:
52
                                                               line)):
53
                last_line = line.strip()
53
                last_line = line.strip()
54
                # break loop if the trace is too big or
54
                # break loop if the trace is too big or
55
                # if last trace line with error name was found
55
                # if last trace line with error name was found
 Lines 67-76   class CheckLogFiles(object): Link Here 
67
        Extracts the traceback message and appends it to the
67
        Extracts the traceback message and appends it to the
68
        output 'errors' with a given 'msg' in the beginning.
68
        output 'errors' with a given 'msg' in the beginning.
69
        """
69
        """
70
        for pattern in definitions.Tracebacks.wanted:
70
        if self.tracebacks.wanted(line):
71
            if pattern.match(line):
71
            errors.append(msg + '\n' + self.extract_traceback_message())
72
                errors.append(msg + '\n' + self.extract_traceback_message())
72
            return errors
73
                return errors
74
73
75
        return errors
74
        return errors
76
75
 Lines 80-93   class CheckLogFiles(object): Link Here 
80
        adds message 'msg' to list 'result' if pattern is in 'wanted'.
79
        adds message 'msg' to list 'result' if pattern is in 'wanted'.
81
        Ignores the patterns matching 'ignore'. Returns 'result'.
80
        Ignores the patterns matching 'ignore'. Returns 'result'.
82
        """
81
        """
83
        for pattern in definition.ignore:
82
        if definition.ignore(line):
84
            if pattern.match(line):
83
            return result
85
                return result
86
84
87
        for pattern in definition.wanted:
85
        if definition.wanted(line):
88
            if pattern.match(line):
86
            result.append(msg)
89
                result.append(msg)
87
            return result
90
                return result
91
88
92
        return result
89
        return result
93
90
 Lines 123-133   class CheckLogFiles(object): Link Here 
123
                # skip the message if it is repeated from the previous line:
120
                # skip the message if it is repeated from the previous line:
124
                if line != previous_line:
121
                if line != previous_line:
125
                    errors = self.check_line(line,
122
                    errors = self.check_line(line,
126
                                             self.DefinitionsErrors,
123
                                             self.errors,
127
                                             errors,
124
                                             errors,
128
                                             msg)
125
                                             msg)
129
                    warnings = self.check_line(line,
126
                    warnings = self.check_line(line,
130
                                               self.DefinitionsWarnings,
127
                                               self.warnings,
131
                                               warnings,
128
                                               warnings,
132
                                               msg)
129
                                               msg)
133
130
 Lines 156-168   class CheckLogFiles(object): Link Here 
156
153
157
        # adding warnings and errors caused by absence of
154
        # adding warnings and errors caused by absence of
158
        # join procedure to the ignore lists
155
        # join procedure to the ignore lists
159
        self.DefinitionsErrors.ignore_list.extend(join_errors)
156
        self.errors = Errors(ignore=join_errors)
160
        self.DefinitionsWarnings.ignore_list.extend(join_warnings)
157
        self.warnings = Warnings(ignore=join_warnings)
161
162
        self.DefinitionsErrors.ignore = map(re.compile,
163
                                            self.DefinitionsErrors.ignore_list)
164
        self.DefinitionsWarnings.ignore = map(re.compile,
165
                                          self.DefinitionsWarnings.ignore_list)
166
158
167
    def check_installation_profile(self):
159
    def check_installation_profile(self):
168
        """
160
        """
(-)a/branches/ucs-3.2/ucs-3.2-3/test/ucs-test/tests/00_base/check_log_files_definitions.py (-66 / +79 lines)
 Lines 2-78    Link Here 
2
import re
2
import re
3
3
4
4
5
class Errors(object):
5
class LogMessage(object):
6
    wanted = map(lambda p: re.compile(p, re.IGNORECASE),
6
	def __init__(self, wanted=None, ignore=None):
7
                 [".*(error).*",
7
		self.wanted = self.recomp(self.wanted_list + (wanted or [])).match
8
                  ".*(failed).*",
8
		self.ignore = self.recomp(self.ignore_list + (ignore or [])).match
9
                  ".*(usage).*",
10
                  "^E:"])
11
9
12
    # possible (ignored) errors:
10
	@staticmethod
13
    ignore_list = [
11
	def recomp(patterns, ignore_case=True):
14
        '.*failedmirror=.*',
12
		pattern = '|'.join('(?:%s)' % _ for _ in patterns)
15
        'All done, no errors.',
13
		return re.compile(pattern, re.IGNORECASE if ignore_case else 0)
16
        'I: .* libgpg-error0',
17
        'Installation finished. No error.* reported',
18
        'Not updating .*',
19
        'Error: There are no (services|hosts|host groups|contacts|contact groups) defined!',
20
        'Total Errors:\s+\d+',
21
        'Cannot find nagios object .*',
22
        'invoke-rc.d: initscript udev, action "reload" failed.',			# Bug 19227
23
        'yes: write error',
24
        '.*Update aborted by pre-update script of release.*',
25
        '.*update failed. Please check /var/log/univention/.*',
26
        '.*failed to convert the username listfilter to the uid.*',
27
        '.*Can not write log, .* failed.*',
28
        '.*Starting Univention Directory Policy:.*',
29
        '.*LISTENER .* : failed to connect to any notifier.*',
30
        '.*liberror-perl.*',
31
        '.*CONSISTENCY CHECK FAILED: cyls is too large .* setting to possible max .*',
32
        '.*error adding .*.pem',
33
        '.*failed .*VM used: java-6-cacao.*',
34
        '.*/etc/ca-certificates/update.d/.* exited with code 1']
35
14
36
    ignore = map(re.compile, ignore_list)
37
15
16
class Errors(LogMessage):
17
	wanted_list = [
18
		".*error.*",
19
		".*failed.*",
20
		".*usage.*",
21
		"^E:",
22
	]
38
23
39
class Tracebacks(object):
24
	# possible (ignored) errors:
40
    wanted = map(lambda p: re.compile(p, re.IGNORECASE),
25
	ignore_list = [
41
                 [".*(traceback).*"])
26
		'.*failedmirror=.*',
27
		'All done, no errors.',
28
		'I: .* libgpg-error0',
29
		'Installation finished. No error.* reported',
30
		'Not updating .*',
31
		'Error: There are no (?:services|hosts|host groups|contacts|contact groups) defined!',
32
		'Total Errors:\s+\d+',
33
		'Cannot find nagios object .*',
34
		'invoke-rc.d: initscript udev, action "reload" failed.',			# Bug 19227
35
		'yes: write error',
36
		'.*Update aborted by pre-update script of release.*',
37
		'.*update failed. Please check /var/log/univention/.*',
38
		'.*failed to convert the username listfilter to the uid.*',
39
		'.*Can not write log, .* failed.*',
40
		'.*Starting Univention Directory Policy:.*',
41
		'.*LISTENER .* : failed to connect to any notifier.*',
42
		'.*liberror-perl.*',
43
		'.*CONSISTENCY CHECK FAILED: cyls is too large .* setting to possible max .*',
44
		'.*error adding .*.pem',
45
		'.*failed .*VM used: java-6-cacao.*',
46
		'.*/etc/ca-certificates/update.d/.* exited with code 1',
47
	]
42
48
43
49
44
class Warnings(object):
50
class Tracebacks(LogMessage):
45
    wanted = map(lambda p: re.compile(p, re.IGNORECASE),
51
	wanted_list = [
46
                 [".*(warning).*"])
52
		".*traceback.*",
53
	]
47
54
48
    # possible (ignored) warnings:
55
	ignore_list = []
49
    ignore_list = [
50
        'WARNING: The following packages cannot be authenticated!',
51
        'Authentication warning overridden.',
52
        '^Create .*/warning',
53
        'WARNING: You are logged in using SSH -- this may interrupt the update and result in an inconsistent system!',
54
        'dpkg - warning: ignoring request to remove .* which isn.t installed.',
55
        'dpkg: warning - unable to delete old directory .*: Directory not empty',
56
        'dpkg - warning, overriding problem because --force enabled',
57
        'dpkg: serious warning: files list file for package .* missing, assuming package has no files currently installed.',
58
        '.*dpkg: warning: unable to delete old directory .* Directory not empty.*',
59
        'WARNING: cannot append .* to .*, value exists',
60
        'Warning: The config registry variable .*? does not exist',
61
        'Total Warnings:\s+\d+',
62
        'sys:1: DeprecationWarning: Non-ASCII character.*but no encoding declared; see http://www.python.org/peps/pep-0263.html for details',
63
        'warning: commands will be executed using /bin/.*',
64
        'Not updating .*',
65
        'Warning: The home dir .* you specified already exists.',
66
        'WARNING!',
67
        '.*WARNING: All config files need \.conf: /etc/modprobe\.d/.+, it will be ignored in a future release\.',
68
        'update-rc\.d: warning: .* (start|stop) runlevel arguments \([^)]+\) do not match LSB Default-(Start|Stop) values ([^)]+)',
69
        '.*warning: rule .* already exists.*',
70
        '.*Not starting .*: no services enabled.*',
71
        '.*Running /etc/init.d/.* is deprecated.*',
72
        '.*The resulting partition is not properly aligned for best performance.*',
73
        '.*Updating certificates in /etc/ssl/certs.* WARNING: Skipping duplicate certificate ca-certificates.crt.*',
74
        '.*Permanently added .* to the list of known hosts.*',
75
        '.*usr/sbin/grub-probe: warning: disk does not exist, so falling back to partition device.*',
76
        '.*WARNING: cannot read /sys/block/vda.* (No such file or directory|Datei oder Verzeichnis nicht gefunden).*']
77
56
78
    ignore = map(re.compile, ignore_list)
57
58
class Warnings(LogMessage):
59
	wanted_list = [
60
		".*warning.*",
61
	]
62
63
	# possible (ignored) warnings:
64
	ignore_list = [
65
		'WARNING: The following packages cannot be authenticated!',
66
		'Authentication warning overridden.',
67
		'^Create .*/warning',
68
		'WARNING: You are logged in using SSH -- this may interrupt the update and result in an inconsistent system!',
69
		'dpkg - warning: ignoring request to remove .* which isn.t installed.',
70
		'dpkg: warning - unable to delete old directory .*: Directory not empty',
71
		'dpkg - warning, overriding problem because --force enabled',
72
		'dpkg: serious warning: files list file for package .* missing, assuming package has no files currently installed.',
73
		'.*dpkg: warning: unable to delete old directory .* Directory not empty.*',
74
		'WARNING: cannot append .* to .*, value exists',
75
		'Warning: The config registry variable .*? does not exist',
76
		'Total Warnings:\s+\d+',
77
		'sys:1: DeprecationWarning: Non-ASCII character.*but no encoding declared; see http://www.python.org/peps/pep-0263.html for details',
78
		'warning: commands will be executed using /bin/.*',
79
		'Not updating .*',
80
		'Warning: The home dir .* you specified already exists.',
81
		'WARNING!',
82
		'.*WARNING: All config files need \.conf: /etc/modprobe\.d/.+, it will be ignored in a future release\.',
83
		'update-rc\.d: warning: .* (?:start|stop) runlevel arguments \([^)]+\) do not match LSB Default-(?:Start|Stop) values [^)]+',
84
		'.*warning: rule .* already exists.*',
85
		'.*Not starting .*: no services enabled.*',
86
		'.*Running /etc/init.d/.* is deprecated.*',
87
		'.*The resulting partition is not properly aligned for best performance.*',
88
		'.*Updating certificates in /etc/ssl/certs.* WARNING: Skipping duplicate certificate ca-certificates.crt.*',
89
		'.*Permanently added .* to the list of known hosts.*',
90
		'.*usr/sbin/grub-probe: warning: disk does not exist, so falling back to partition device.*',
91
		'.*WARNING: cannot read /sys/block/vda.* (?:No such file or directory|Datei oder Verzeichnis nicht gefunden).*']

Return to bug 30751