Univention Bugzilla – Attachment 8919 Details for
Bug 38974
Traceback in sources.list files should be recognized
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
38974-diagnostic-traceback-sources-list-420.patch
38974-diagnostic-traceback-sources-list-420.patch (text/plain), 6.34 KB, created by
Lukas Oyen
on 2017-06-13 16:09:59 CEST
(
hide
)
Description:
38974-diagnostic-traceback-sources-list-420.patch
Filename:
MIME Type:
Creator:
Lukas Oyen
Created:
2017-06-13 16:09:59 CEST
Size:
6.34 KB
patch
obsolete
>From a0229255d999efbaee06f30416dbcc95fef8f6f5 Mon Sep 17 00:00:00 2001 >From: Lukas Oyen <oyen@univention.de> >Date: Mon, 12 Jun 2017 17:26:27 +0200 >Subject: [PATCH 1/2] Bug #38974: umc-diagnostic: new check > sources_list_check.py > >--- > .../diagnostic/plugins/sources_list_check.py | 93 ++++++++++++++++++++++ > 1 file changed, 93 insertions(+) > create mode 100755 management/univention-management-console-module-diagnostic/umc/python/diagnostic/plugins/sources_list_check.py > >diff --git a/management/univention-management-console-module-diagnostic/umc/python/diagnostic/plugins/sources_list_check.py b/management/univention-management-console-module-diagnostic/umc/python/diagnostic/plugins/sources_list_check.py >new file mode 100755 >index 0000000..3b506a1 >--- /dev/null >+++ b/management/univention-management-console-module-diagnostic/umc/python/diagnostic/plugins/sources_list_check.py >@@ -0,0 +1,93 @@ >+#!/usr/bin/python2.7 >+# coding: utf-8 >+# >+# Univention Management Console module: >+# System Diagnosis UMC module >+# >+# Copyright 2017 Univention GmbH >+# >+# http://www.univention.de/ >+# >+# All rights reserved. >+# >+# The source code of this program is made available >+# under the terms of the GNU Affero General Public License version 3 >+# (GNU AGPL V3) as published by the Free Software Foundation. >+# >+# Binary versions of this program provided by Univention to you as >+# well as other copyrighted, protected or trademarked materials like >+# Logos, graphics, fonts, specific documentations and configurations, >+# cryptographic keys etc. are subject to a license agreement between >+# you and Univention and not subject to the GNU AGPL V3. >+# >+# In the case you use this program under the terms of the GNU AGPL V3, >+# the program is provided in the hope that it will be useful, >+# but WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU Affero General Public License for more details. >+# >+# You should have received a copy of the GNU Affero General Public >+# License with the Debian GNU/Linux or Univention distribution in file >+# /usr/share/common-licenses/AGPL-3; if not, see >+# <http://www.gnu.org/licenses/>. >+ >+import re >+import glob >+ >+from univention.management.console.modules.diagnostic import Warning >+ >+from univention.lib.i18n import Translation >+_ = Translation('univention-management-console-module-diagnostic').translate >+ >+title = _('Check errors in sources.list files') >+description = _('All files ok.') >+ >+ >+TRACEBACK_REGEX = re.compile(( >+ '#\s+Traceback \(most recent call last\):\n' # start of exception >+ '(?:.*\n)+?' # irrelevant lines of detail >+ '#\s+raise (?P<exception>\w+).*\n' # `raise` line to exctract the exception class >+ '#\s+(?P=exception): (?P<message>.*)\n')) # extract exception message >+ >+ >+IGNORED_EXCEPTIONS = set() >+ >+ >+class TracebackFound(Exception): >+ def __init__(self, path, exception, message): >+ super(TracebackFound, self).__init__(path, exception, message) >+ self.path = path >+ self.exception = exception >+ self.message = message >+ >+ def __str__(self): >+ msg = _('Found exception in {path!r}: {exception} - {message}') >+ return msg.format(path=self.path, exception=self.exception, message=self.message) >+ >+ >+def find_tracebacks(path): >+ with open(path) as fob: >+ content = fob.read() >+ for match in TRACEBACK_REGEX.finditer(content): >+ yield (match.group('exception'), match.group('message')) >+ >+ >+def check_for_tracebacks(): >+ for path in glob.iglob('/etc/apt/sources.list.d/*'): >+ for (exception, message) in find_tracebacks(path): >+ yield TracebackFound(path, exception, message) >+ >+ >+def run(): >+ exceptions = (exc for exc in check_for_tracebacks() >+ if exc.exception not in IGNORED_EXCEPTIONS) >+ >+ error_descriptions = [str(exc) for exc in exceptions] >+ if error_descriptions: >+ error_descriptions.append(_('Please check the files for more details.')) >+ raise Warning(description='\n'.join(error_descriptions)) >+ >+ >+if __name__ == '__main__': >+ from univention.management.console.modules.diagnostic import main >+ main() >-- >2.7.4 > > >From af836fc0eedf6eb6bc5b52f3881a950027fa9c76 Mon Sep 17 00:00:00 2001 >From: Lukas Oyen <oyen@univention.de> >Date: Tue, 13 Jun 2017 16:00:27 +0200 >Subject: [PATCH 2/2] Bug #38974: umc-diagnostic: new check > sources_list_check.py (po) > >--- > .../umc/python/diagnostic/de.po | 20 ++++++++++++++++++-- > 1 file changed, 18 insertions(+), 2 deletions(-) > >diff --git a/management/univention-management-console-module-diagnostic/umc/python/diagnostic/de.po b/management/univention-management-console-module-diagnostic/umc/python/diagnostic/de.po >index affad86..cc2981f 100644 >--- a/management/univention-management-console-module-diagnostic/umc/python/diagnostic/de.po >+++ b/management/univention-management-console-module-diagnostic/umc/python/diagnostic/de.po >@@ -2,8 +2,8 @@ > msgid "" > msgstr "" > "Project-Id-Version: univention-management-console-module-diagnostic\n" >-"Report-Msgid-Bugs-To: packages@univention.de\n" >-"POT-Creation-Date: 2016-01-14 12:19+0100\n" >+"Report-Msgid-Bugs-To: \n" >+"POT-Creation-Date: 2017-06-13 16:03+0200\n" > "PO-Revision-Date: \n" > "Last-Translator: Univention GmbH <packages@univention.de>\n" > "Language-Team: Univention GmbH <packages@univention.de>\n" >@@ -27,6 +27,18 @@ msgstr "" > msgid "Adjust to suggested limits" > msgstr "An vorgeschlagene Limits anpassen" > >+#: umc/python/diagnostic/plugins/sources_list_check.py:43 >+msgid "All files ok." >+msgstr "Alle Dateien in Ordnung." >+ >+#: umc/python/diagnostic/plugins/sources_list_check.py:42 >+msgid "Check errors in sources.list files" >+msgstr "Ãberprüfe Fehler in den sources.list Dateien" >+ >+#: umc/python/diagnostic/plugins/sources_list_check.py:64 >+msgid "Found exception in {path!r}: {exception} - {message}" >+msgstr "Fehler in {path!r} gefunden: {exception} - {message}" >+ > #: umc/python/diagnostic/plugins/gateway.py:11 > msgid "Gateway is not reachable" > msgstr "Gateway ist nicht erreichbar" >@@ -108,6 +120,10 @@ msgstr "" > "Bitte prüfen Sie /var/log/auth.log auf dem entfernten Rechner für weitere " > "Informationen." > >+#: umc/python/diagnostic/plugins/sources_list_check.py:87 >+msgid "Please check the files for more details." >+msgstr "Ãberprüfen Sie die Dateine für mehr Details." >+ > #: umc/python/diagnostic/plugins/nameserver.py:16 > msgid "" > "Please make sure the DNS settings in the {setup:network} are correctly set " >-- >2.7.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 38974
:
8919
|
8920