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

(-)a/management/univention-management-console-module-diagnostic/umc/python/diagnostic/plugins/check_update_sites.py (-2 / +63 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, see
32
# <http://www.gnu.org/licenses/>.
33
34
import requests
35
import univention.config_registry
36
37
from univention.management.console.modules.diagnostic import Warning
38
39
from univention.lib.i18n import Translation
40
_ = Translation('univention-management-console-module-diagnostic').translate
41
42
title = _('Check for errors with update sites')
43
description = _('No new problems were found while connecting to updates sites')
44
45
46
def run():
47
	ucr = univention.config_registry.ConfigRegistry()
48
	ucr.load()
49
	description_items = []
50
	sites = ucr.get("repository/credentials/Univention Software Repository/uris").split(" ")
51
	for site in sites:
52
		uri = "https://%s" % (site)
53
		code = requests.get(uri).status_code
54
		if not code == 200:
55
			description_items.append("Errorcode %s during connecting to %s" % (code, uri))
56
	if len(description_items) > 0:
57
		description = "\n".join(description_items)
58
		raise Warning(description)
59
60
61
if __name__ == '__main__':
62
	from univention.management.console.modules.diagnostic import main
63
	main()
1
check_update_sites
64
check_update_sites
2
--
3
.../diagnostic/plugins/check_update_sites.py       | 56 +++++++++++++++-------
65
.../diagnostic/plugins/check_update_sites.py       | 56 +++++++++++++++-------
4
1 file changed, 40 insertions(+), 16 deletions(-)
66
1 file changed, 40 insertions(+), 16 deletions(-)
5
mode change 100644 => 100755 management/univention-management-console-module-diagnostic/umc/python/diagnostic/plugins/check_update_sites.py
67
mode change 100644 => 100755 management/univention-management-console-module-diagnostic/umc/python/diagnostic/plugins/check_update_sites.py
(-)a/management/univention-management-console-module-diagnostic/umc/python/diagnostic/plugins/check_update_sites.py (-18 / +40 lines)
 Lines 31-61    Link Here 
31
# /usr/share/common-licenses/AGPL-3; if not, see
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
import requests
34
import socket
35
import univention.config_registry
35
import urlparse
36
36
37
import univention.config_registry
37
from univention.management.console.modules.diagnostic import Warning
38
from univention.management.console.modules.diagnostic import Warning
38
39
39
from univention.lib.i18n import Translation
40
from univention.lib.i18n import Translation
40
_ = Translation('univention-management-console-module-diagnostic').translate
41
_ = Translation('univention-management-console-module-diagnostic').translate
41
42
42
title = _('Check for errors with update sites')
43
title = _('Check resolving repository servers')
43
description = _('No new problems were found while connecting to updates sites')
44
description = _('No problems were found while resolving update respositories.')
45
links = [{
46
	'name': 'sdb',
47
	'href': _('http://sdb.univention.de/1298'),
48
	'label': _('Univention Support Database - DNS Server on DC does not resolve external names')
49
}]
50
51
52
def repositories():
53
	configRegistry = univention.config_registry.ConfigRegistry()
54
	configRegistry.load()
55
56
	if configRegistry.is_true('repository/online', True):
57
		yield configRegistry.get('repository/online/server', 'updates.software-univention.de/')
58
		yield configRegistry.get('repository/app_center/server', 'appcenter.software-univention.de')
59
60
61
def test_resolve(url):
62
	parsed = urlparse.urlsplit(url if '//' in url else '//' + url)
63
	try:
64
		socket.getaddrinfo(parsed.hostname, parsed.scheme)
65
	except socket.gaierror:
66
		return False
67
	return True
68
69
70
def unresolvable_repositories():
71
	for repository in repositories():
72
		if not test_resolve(repository):
73
			yield repository
44
74
45
75
46
def run():
76
def run():
47
	ucr = univention.config_registry.ConfigRegistry()
77
	error_descriptions = [_('The following FQDNs were not resolvable:')]
48
	ucr.load()
78
	unresolvable = list(unresolvable_repositories())
49
	description_items = []
79
	if unresolvable:
50
	sites = ucr.get("repository/credentials/Univention Software Repository/uris").split(" ")
80
		error_descriptions.extend(unresolvable)
51
	for site in sites:
81
		error_descriptions.append(_('Please see {sdb} for troubleshooting DNS problems.'))
52
		uri = "https://%s" % (site)
82
		raise Warning(description='\n'.join(error_descriptions))
53
		code = requests.get(uri).status_code
54
		if not code == 200:
55
			description_items.append("Errorcode %s during connecting to %s" % (code, uri))
56
	if len(description_items) > 0:
57
		description = "\n".join(description_items)
58
		raise Warning(description)
59
83
60
84
61
if __name__ == '__main__':
85
if __name__ == '__main__':
62
- 
63
check_update_sites (po)
86
check_update_sites (po)
64
--
65
.../umc/python/diagnostic/de.po                    | 31 ++++++++++++++++++++--
87
.../umc/python/diagnostic/de.po                    | 31 ++++++++++++++++++++--
66
1 file changed, 29 insertions(+), 2 deletions(-)
88
1 file changed, 29 insertions(+), 2 deletions(-)
(-)a/management/univention-management-console-module-diagnostic/umc/python/diagnostic/de.po (-3 / +29 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-01 16:16+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_update_sites.py:43
31
msgid "Check resolving repository servers"
32
msgstr "Überprüfe DNS Auflösung der Repository Server"
33
30
#: umc/python/diagnostic/plugins/gateway.py:11
34
#: umc/python/diagnostic/plugins/gateway.py:11
31
msgid "Gateway is not reachable"
35
msgid "Gateway is not reachable"
32
msgstr "Gateway ist nicht erreichbar"
36
msgstr "Gateway ist nicht erreichbar"
 Lines 97-102   msgstr "" Link Here 
97
msgid "Nameserver(s) are not responsive"
101
msgid "Nameserver(s) are not responsive"
98
msgstr "Nameserver sind nicht ansprechbar"
102
msgstr "Nameserver sind nicht ansprechbar"
99
103
104
#: umc/python/diagnostic/plugins/check_update_sites.py:44
105
msgid "No problems were found while resolving update respositories."
106
msgstr "Es wurden keine Probleme beim Auflösen der Repository-Server gefunden."
107
100
#: umc/python/diagnostic/plugins/package_status.py:11
108
#: umc/python/diagnostic/plugins/package_status.py:11
101
msgid "Package status corrupt"
109
msgid "Package status corrupt"
102
msgstr "Paketstatus korrupt"
110
msgstr "Paketstatus korrupt"
 Lines 125-130   msgstr "" Link Here 
125
"Der SSH Host-Key in /root/.ssh/known_hosts des entfernten Rechners muss auf "
133
"Der SSH Host-Key in /root/.ssh/known_hosts des entfernten Rechners muss auf "
126
"%(fqdn)s repariert werden."
134
"%(fqdn)s repariert werden."
127
135
136
#: umc/python/diagnostic/plugins/check_update_sites.py:81
137
#, python-brace-format
138
msgid "Please see {sdb} for troubleshooting DNS problems."
139
msgstr "Siehe {sdb} für Problemhilfe bei DNS Problemen."
140
128
#: umc/python/diagnostic/plugins/proxy.py:15
141
#: umc/python/diagnostic/plugins/proxy.py:15
129
msgid "Proxy server failure"
142
msgid "Proxy server failure"
130
msgstr "Proxy-Server-Fehler"
143
msgstr "Proxy-Server-Fehler"
 Lines 141-146   msgstr "Sicherheitslimits überschritten" Link Here 
141
msgid "Test again"
154
msgid "Test again"
142
msgstr "Erneut testen"
155
msgstr "Erneut testen"
143
156
157
#: umc/python/diagnostic/plugins/check_update_sites.py:77
158
msgid "The following FQDNs were not resolvable:"
159
msgstr "Die folgenden FQDNs waren nicht auflösbar:"
160
144
#: umc/python/diagnostic/plugins/ssh_connection.py:48
161
#: umc/python/diagnostic/plugins/ssh_connection.py:48
145
msgid ""
162
msgid ""
146
"The following list shows the affected remote servers and the reason for the "
163
"The following list shows the affected remote servers and the reason for the "
 Lines 260-265   msgstr "" Link Here 
260
"dass Authentifikations-Zugangsdaten (falls existierend) korrekt sind und die "
277
"dass Authentifikations-Zugangsdaten (falls existierend) korrekt sind und die "
261
"ACL's des Proxy-Servers nicht verbieten, Anfragen an %s zu stellen."
278
"ACL's des Proxy-Servers nicht verbieten, Anfragen an %s zu stellen."
262
279
280
#: umc/python/diagnostic/plugins/check_update_sites.py:48
281
msgid ""
282
"Univention Support Database - DNS Server on DC does not resolve external "
283
"names"
284
msgstr ""
285
286
#: umc/python/diagnostic/plugins/check_update_sites.py:47
287
msgid "http://sdb.univention.de/1298"
288
msgstr ""
289
263
#: umc/python/diagnostic/plugins/package_status.py:28
290
#: umc/python/diagnostic/plugins/package_status.py:28
264
msgid "some"
291
msgid "some"
265
msgstr "einigen"
292
msgstr "einigen"
266
- 

Return to bug 37628