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

(-)a/management/univention-management-console-module-diagnostic/umc/python/diagnostic/plugins/check_ucr_templates.py (-2 / +80 lines)
Line 0    Link Here 
0
- 
1
#!/usr/bin/python2.7
2
# coding: utf-8
3
#
4
# Univention Management Console module:
5
#  System Diagnosis UMC module
6
#
7
# Copyright 2016-2017 Univention GmbH
8
#
9
# http://www.univention.de/
10
#
11
# All rights reserved.
12
#
13
# The source code of this program is made available
14
# under the terms of the GNU Affero General Public License version 3
15
# (GNU AGPL V3) as published by the Free Software Foundation.
16
#
17
# Binary versions of this program provided by Univention to you as
18
# well as other copyrighted, protected or trademarked materials like
19
# Logos, graphics, fonts, specific documentations and configurations,
20
# cryptographic keys etc. are subject to a license agreement between
21
# you and Univention and not subject to the GNU AGPL V3.
22
#
23
# In the case you use this program under the terms of the GNU AGPL V3,
24
# the program is provided in the hope that it will be useful,
25
# but WITHOUT ANY WARRANTY; without even the implied warranty of
26
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27
# GNU Affero General Public License for more details.
28
#
29
# You should have received a copy of the GNU Affero General Public
30
# License with the Debian GNU/Linux or Univention distribution in file
31
# /usr/share/common-licenses/AGPL-3; if not, seG
32
# <http://www.gnu.org/licenses/>.
33
34
35
from subprocess import Popen, PIPE, STDOUT
36
from univention.management.console.config import ucr
37
from univention.management.console.modules.diagnostic import Critical
38
39
from univention.lib.i18n import Translation
40
_ = Translation('univention-management-console-module-diagnostic').translate
41
42
title = _('Check for blocked ucr templates')
43
description = _('No problems found with blocked ucr templates')
44
45
46
def run():
47
	ucr.load()
48
	try:
49
		process = Popen(["univention-check-templates"], stdout=PIPE, stderr=STDOUT)
50
		stdout, stderr = process.communicate()
51
		if process.returncode:
52
			description = _("Calling 'univention-check-templates failed")
53
			raise Critical("\n".join([
54
				description,
55
				"Returncode of process: %s" % (process.returncode),
56
				"stderr: %s" % (stderr)
57
			]))
58
		if stdout == "":
59
			return
60
		else:
61
			description = _("Error from 'univention-check-templates' returned.")
62
			raise Critical("\n".join([
63
				description,
64
				"Stdout: %s" % (stdout),
65
				"Stderr: %s" % (stderr)
66
			]))
67
	except Critical:
68
		raise
69
	except Exception as ex:
70
		description = _("Unknown problem during check of 'univention-check-templates")
71
		raise Critical('\n'.join([
72
			description,
73
			"Exception-Type: %s" % (ex.__class__),
74
			"Exception-Message: %s" % (ex.message)
75
		]))
76
77
78
if __name__ == '__main__':
79
	from univention.management.console.modules.diagnostic import main
80
	main()
1
`check_ucr_templates.py`
81
`check_ucr_templates.py`
2
--
3
.../diagnostic/plugins/check_ucr_templates.py      | 51 ++++++++--------------
82
.../diagnostic/plugins/check_ucr_templates.py      | 51 ++++++++--------------
4
1 file changed, 17 insertions(+), 34 deletions(-)
83
1 file changed, 17 insertions(+), 34 deletions(-)
5
mode change 100644 => 100755 management/univention-management-console-module-diagnostic/umc/python/diagnostic/plugins/check_ucr_templates.py
84
mode change 100644 => 100755 management/univention-management-console-module-diagnostic/umc/python/diagnostic/plugins/check_ucr_templates.py
(-)a/management/univention-management-console-module-diagnostic/umc/python/diagnostic/plugins/check_ucr_templates.py (-36 / +17 lines)
 Lines 28-78    Link Here 
28
#
28
#
29
# You should have received a copy of the GNU Affero General Public
29
# You should have received a copy of the GNU Affero General Public
30
# License with the Debian GNU/Linux or Univention distribution in file
30
# License with the Debian GNU/Linux or Univention distribution in file
31
# /usr/share/common-licenses/AGPL-3; if not, seG
31
# /usr/share/common-licenses/AGPL-3; if not, see
32
# <http://www.gnu.org/licenses/>.
32
# <http://www.gnu.org/licenses/>.
33
33
34
34
35
from subprocess import Popen, PIPE, STDOUT
35
import subprocess
36
from univention.management.console.config import ucr
36
from univention.management.console.modules.diagnostic import Warning
37
from univention.management.console.modules.diagnostic import Critical
38
37
39
from univention.lib.i18n import Translation
38
from univention.lib.i18n import Translation
40
_ = Translation('univention-management-console-module-diagnostic').translate
39
_ = Translation('univention-management-console-module-diagnostic').translate
41
40
42
title = _('Check for blocked ucr templates')
41
title = _('Check for modified UCR templates')
43
description = _('No problems found with blocked ucr templates')
42
description = _('No problems found with modified UCR templates')
44
43
45
44
46
def run():
45
def run():
47
	ucr.load()
46
	cmd = ['univention-check-templates']
48
	try:
47
	try:
49
		process = Popen(["univention-check-templates"], stdout=PIPE, stderr=STDOUT)
48
		subprocess.check_output(cmd)
50
		stdout, stderr = process.communicate()
49
	except subprocess.CalledProcessError as error:
51
		if process.returncode:
50
		error_description = [
52
			description = _("Calling 'univention-check-templates failed")
51
			_('Errors found by `univention-check-templates`.'),
53
			raise Critical("\n".join([
52
			_('The following UCR files are modified locally.'),
54
				description,
53
			_('Updated versions will be named FILENAME.dpkg-*.'),
55
				"Returncode of process: %s" % (process.returncode),
54
			_('The files should be checked for differences.'),
56
				"stderr: %s" % (stderr)
55
		]
57
			]))
56
		if error.output:
58
		if stdout == "":
57
			error_description.extend(('\n\n', error.output))
59
			return
58
		raise Warning(' '.join(error_description))
60
		else:
61
			description = _("Error from 'univention-check-templates' returned.")
62
			raise Critical("\n".join([
63
				description,
64
				"Stdout: %s" % (stdout),
65
				"Stderr: %s" % (stderr)
66
			]))
67
	except Critical:
68
		raise
69
	except Exception as ex:
70
		description = _("Unknown problem during check of 'univention-check-templates")
71
		raise Critical('\n'.join([
72
			description,
73
			"Exception-Type: %s" % (ex.__class__),
74
			"Exception-Message: %s" % (ex.message)
75
		]))
76
59
77
60
78
if __name__ == '__main__':
61
if __name__ == '__main__':
79
- 
80
(po)
62
(po)
81
--
82
.../umc/python/diagnostic/de.po                    | 30 +++++++++++++++++++---
63
.../umc/python/diagnostic/de.po                    | 30 +++++++++++++++++++---
83
1 file changed, 27 insertions(+), 3 deletions(-)
64
1 file changed, 27 insertions(+), 3 deletions(-)
(-)a/management/univention-management-console-module-diagnostic/umc/python/diagnostic/de.po (-4 / +27 lines)
 Lines 2-9    Link Here 
2
msgid ""
2
msgid ""
3
msgstr ""
3
msgstr ""
4
"Project-Id-Version: univention-management-console-module-diagnostic\n"
4
"Project-Id-Version: univention-management-console-module-diagnostic\n"
5
"Report-Msgid-Bugs-To: packages@univention.de\n"
5
"Report-Msgid-Bugs-To: \n"
6
"POT-Creation-Date: 2016-01-14 12:19+0100\n"
6
"POT-Creation-Date: 2017-06-27 16:21+0200\n"
7
"PO-Revision-Date: \n"
7
"PO-Revision-Date: \n"
8
"Last-Translator: Univention GmbH <packages@univention.de>\n"
8
"Last-Translator: Univention GmbH <packages@univention.de>\n"
9
"Language-Team: Univention GmbH <packages@univention.de>\n"
9
"Language-Team: Univention GmbH <packages@univention.de>\n"
 Lines 27-32   msgstr "" Link Here 
27
msgid "Adjust to suggested limits"
27
msgid "Adjust to suggested limits"
28
msgstr "An vorgeschlagene Limits anpassen"
28
msgstr "An vorgeschlagene Limits anpassen"
29
29
30
#: umc/python/diagnostic/plugins/check_ucr_templates.py:41
31
msgid "Check for modified UCR templates"
32
msgstr "Überprüfe veränderte UCR Vorlagen"
33
34
#: umc/python/diagnostic/plugins/check_ucr_templates.py:51
35
msgid "Errors found by `univention-check-templates`."
36
msgstr "Es wurden Fehler durch `univention-check-templates` gefunden."
37
30
#: umc/python/diagnostic/plugins/gateway.py:11
38
#: umc/python/diagnostic/plugins/gateway.py:11
31
msgid "Gateway is not reachable"
39
msgid "Gateway is not reachable"
32
msgstr "Gateway ist nicht erreichbar"
40
msgstr "Gateway ist nicht erreichbar"
 Lines 97-102   msgstr "" Link Here 
97
msgid "Nameserver(s) are not responsive"
105
msgid "Nameserver(s) are not responsive"
98
msgstr "Nameserver sind nicht ansprechbar"
106
msgstr "Nameserver sind nicht ansprechbar"
99
107
108
#: umc/python/diagnostic/plugins/check_ucr_templates.py:42
109
msgid "No problems found with modified UCR templates"
110
msgstr "Keine Probleme mit modifizierten UCR Vorlagen gefunden."
111
100
#: umc/python/diagnostic/plugins/package_status.py:11
112
#: umc/python/diagnostic/plugins/package_status.py:11
101
msgid "Package status corrupt"
113
msgid "Package status corrupt"
102
msgstr "Paketstatus korrupt"
114
msgstr "Paketstatus korrupt"
 Lines 141-147   msgstr "Sicherheitslimits überschritten" Link Here 
141
msgid "Test again"
153
msgid "Test again"
142
msgstr "Erneut testen"
154
msgstr "Erneut testen"
143
155
144
#: umc/python/diagnostic/plugins/ssh_connection.py:48
156
#: umc/python/diagnostic/plugins/check_ucr_templates.py:54
157
msgid "The files should be checked for differences."
158
msgstr "Die Dateien sollten auf Unterschiede geprüft werden."
159
160
#: umc/python/diagnostic/plugins/check_ucr_templates.py:52
161
msgid "The following UCR files are modified locally."
162
msgstr "Die folgenden UCR Vorlagen wurden lokal verändert."
163
164
#: umc/python/diagnostic/plugins/ssh_connection.py:52
145
msgid ""
165
msgid ""
146
"The following list shows the affected remote servers and the reason for the "
166
"The following list shows the affected remote servers and the reason for the "
147
"failed ssh connection:"
167
"failed ssh connection:"
 Lines 260-265   msgstr "" Link Here 
260
"dass Authentifikations-Zugangsdaten (falls existierend) korrekt sind und die "
280
"dass Authentifikations-Zugangsdaten (falls existierend) korrekt sind und die "
261
"ACL's des Proxy-Servers nicht verbieten, Anfragen an %s zu stellen."
281
"ACL's des Proxy-Servers nicht verbieten, Anfragen an %s zu stellen."
262
282
283
#: umc/python/diagnostic/plugins/check_ucr_templates.py:53
284
msgid "Updated versions will be named FILENAME.dpkg-*."
285
msgstr "Aktualisierte Versionen werden DATEINAME.dpkg-* genannt."
286
263
#: umc/python/diagnostic/plugins/package_status.py:28
287
#: umc/python/diagnostic/plugins/package_status.py:28
264
msgid "some"
288
msgid "some"
265
msgstr "einigen"
289
msgstr "einigen"
266
- 

Return to bug 44874