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

(-)univention-updater/debian/control (+2 lines)
 Lines 8-13    Link Here 
8
 python-support (>= 0.90),
8
 python-support (>= 0.90),
9
 python-debian,
9
 python-debian,
10
 python-apt,
10
 python-apt,
11
 python-yaml,
11
 ucslint-univention,
12
 ucslint-univention,
12
 univention-management-console-dev
13
 univention-management-console-dev
13
XS-Python-Version: 2.6, 2.7
14
XS-Python-Version: 2.6, 2.7
 Lines 24-29    Link Here 
24
 python-univention-lib (>= 1.0.25-1),
25
 python-univention-lib (>= 1.0.25-1),
25
 python-debian,
26
 python-debian,
26
 python-apt,
27
 python-apt,
28
 python-yaml,
27
 univention-errata-level,
29
 univention-errata-level,
28
 apt-transport-https,
30
 apt-transport-https,
29
 ca-certificates,
31
 ca-certificates,
(-)univention-updater/umc/js/updater/UpdatesPage.js (-6 / +81 lines)
 Lines 36-41    Link Here 
36
	"dojo/dom-class",
36
	"dojo/dom-class",
37
	"dojo/topic",
37
	"dojo/topic",
38
	"dojo/Deferred",
38
	"dojo/Deferred",
39
	"dijit/registry",
39
	"dojox/string/sprintf",
40
	"dojox/string/sprintf",
40
	"umc/app",
41
	"umc/app",
41
	"umc/tools",
42
	"umc/tools",
 Lines 48-54    Link Here 
48
	"umc/modules/updater/Page",
49
	"umc/modules/updater/Page",
49
	"umc/modules/updater/Form",
50
	"umc/modules/updater/Form",
50
	"umc/i18n!umc/modules/updater"
51
	"umc/i18n!umc/modules/updater"
51
], function(declare, lang, array, all, domClass, topic, Deferred, sprintf, UMCApplication, tools, store, server, TitlePane, Text, HiddenInput, ComboBox, Page, Form, _) {
52
], function(declare, lang, array, all, domClass, topic, Deferred, dijitRegistry, sprintf, UMCApplication, tools, store, server, TitlePane, Text, HiddenInput, ComboBox, Page, Form, _) {
53
	var _getParentWidget = function(widget) {
54
		try {
55
			return dijitRegistry.getEnclosingWidget(widget.domNode.parentNode);
56
		} catch(e) {
57
			// could not access _widget.domNode.parentNode
58
			return null;
59
		}
60
	};
61
52
	return declare("umc.modules.updater.UpdatesPage", Page, {
62
	return declare("umc.modules.updater.UpdatesPage", Page, {
53
63
54
		_update_prohibited: false,
64
		_update_prohibited: false,
 Lines 66-71    Link Here 
66
			});
76
			});
67
		},
77
		},
68
78
79
		_getEnclosingTitlePane: function(widgetName) {
80
			var _widget = this._form.getWidget(widgetName) || this._form.getButton(widgetName);
81
			while (_widget != null) {
82
				if (_widget.isInstanceOf(TitlePane)) {
83
					// we successfully found the enclosing TitlePane of the given widget
84
					return _widget;
85
				}
86
				if (_widget.isInstanceOf(Form)) {
87
					// do not search beyond the form widget
88
					return null;
89
				}
90
				_widget = _getParentWidget(_widget);
91
			}
92
		},
93
69
		buildRendering: function() {
94
		buildRendering: function() {
70
95
71
			this.inherited(arguments);
96
			this.inherited(arguments);
 Lines 74-79    Link Here 
74
					type: HiddenInput,
99
					type: HiddenInput,
75
					name: 'reboot_required'
100
					name: 'reboot_required'
76
				}, {
101
				}, {
102
					type:			'Text',
103
					name:			'version_out_of_maintenance_text',
104
					'class':		'umcUpdaterWarningText',
105
					visible:		false,
106
					label:			'',
107
					content:		'', // will be set below as soon as the UCS version is known
108
				}, {
77
					type: Text,
109
					type: Text,
78
					name: 'reboot_text',
110
					name: 'reboot_text',
79
					label: ' ',
111
					label: ' ',
 Lines 335-341    Link Here 
335
				size: 'One'
367
				size: 'One'
336
			}];
368
			}];
337
369
338
			var layout = [{
370
			var layout = [
371
				'version_out_of_maintenance_text',
372
			{
339
				label: _("Reboot required"),
373
				label: _("Reboot required"),
340
				layout: [
374
				layout: [
341
					['reboot_text', 'reboot']
375
					['reboot_text', 'reboot']
 Lines 376-385    Link Here 
376
			// fetch all known/initial titlepanes and save them with their name
410
			// fetch all known/initial titlepanes and save them with their name
377
			// so they can be used later on
411
			// so they can be used later on
378
			this._titlepanes = {
412
			this._titlepanes = {
379
				reboot: this._form._container.getChildren()[0],
413
				reboot: this._getEnclosingTitlePane('reboot'),
380
				easymode: this._form._container.getChildren()[1],
414
				easymode: this._getEnclosingTitlePane('easy_upgrade'),
381
				release: this._form._container.getChildren()[2],
415
				release: this._getEnclosingTitlePane('run_release_update'),
382
				packages: this._form._container.getChildren()[3]
416
				packages: this._getEnclosingTitlePane('run_packages_update')
383
			};
417
			};
384
418
385
			// Before we attach the form to our page, just switch off all title panes.
419
			// Before we attach the form to our page, just switch off all title panes.
 Lines 433-438    Link Here 
433
467
434
					this._show_reboot_pane(tools.isTrue(values.reboot_required));
468
					this._show_reboot_pane(tools.isTrue(values.reboot_required));
435
469
470
					// load maintenance information and show message if out of maintenance
471
					tools.umcpCommand('updater/maintenance_information').then(lang.hitch(this, function(data) {
472
						var info = data.result;
473
						var msg = '';
474
						if (info.maintained === 'extended') {
475
							// TODO add behaviour for extended
476
						} else if (info.maintained === 'false') {
477
							if (info.baseDN === 'Free for personal use edition' || info.baseDN === 'UCS Core Edition') {
478
								msg = lang.replace("Achtung: Sie verwenden aktuell UCS {0} Core Edition. Diese Version ist veraltet und es werden keine Sicherheitsupdates mehr dafür veröffentlicht. Bitte aktualisieren Sie dieses System auf eine neuere UCS Version! Enterprise Subscriptionen bieten für einige Versionen längere Aktualisierungszeiträume. Informationen zu Enterprise Subscriptionen finden Sie auf der <a target='_blank' href='https://www.univention.de/produkte/preise/'>Univention Webseite</a>.", []);
479
							} else if (info.support == 0 && info.premiumSupport == 0) {
480
								msg = '';
481
							} else if (info.support == 1 && info.premiumSupport == 0) {
482
								msg = '';
483
							} else if (info.support == 0 && info.premiumSupport == 1) {
484
								msg = '';
485
							}
486
						}
487
488
						if (msg) {
489
							var outOfMaintenanceWidget = this._form.getWidget('version_out_of_maintenance_text');
490
							outOfMaintenanceWidget.set('content', msg);
491
							outOfMaintenanceWidget.set('visible', true);
492
						}
493
					}));
494
495
436
				} catch(error) {
496
				} catch(error) {
437
					console.error("onLoaded: " + error.message);
497
					console.error("onLoaded: " + error.message);
438
				}
498
				}
 Lines 590-595    Link Here 
590
650
591
		},
651
		},
592
652
653
		postCreate: function() {
654
			// maintenance status
655
			// tools.umcpCommand('updater/maintenance_information').then(function(data) {
656
				// var info = data.result;
657
				// if (info.maintained === 'extended') {
658
					// TODO add behaviour for extended with ucr variable
659
					// return;
660
				// } else if (info.maintained === 'false') {
661
					// if (info.baseDN === 'Free for personal use edition' || info.baseDN === 'UCS Core Edition') {
662
						// var msg = lang.replace("Achtung: Sie verwenden aktuell UCS {0} Core Edition. Diese Version ist veraltet und es werden keine Sicherheitsupdates mehr dafür veröffentlicht. Bitte aktualisieren Sie dieses System auf eine neuere UCS Version! Enterprise Subscriptionen bieten für einige Versionen längere Aktualisierungszeiträume. Informationen zu Enterprise Subscriptionen finden Sie auf der <a target='_blank' href='https://www.univention.de/produkte/preise/'>Univention Webseite</a>.");
663
					// }
664
				// }
665
			// });
666
		},
667
593
		// First page refresh doesn't work properly when invoked in 'buildRendering()' so
668
		// First page refresh doesn't work properly when invoked in 'buildRendering()' so
594
		// we defer it until the UI is being shown
669
		// we defer it until the UI is being shown
595
		startup: function() {
670
		startup: function() {
(-)univention-updater/umc/python/updater/__init__.py (-1 / +31 lines)
 Lines 38-52    Link Here 
38
import subprocess
38
import subprocess
39
import psutil
39
import psutil
40
import pipes
40
import pipes
41
import urllib2
42
import contextlib
43
import yaml
41
44
42
import univention.hooks
45
import univention.hooks
43
import notifier.threads
46
import notifier.threads
44
47
48
import univention.admin.modules as udm_modules
49
import univention.admin.uldap as udm_uldap
45
from univention.lib.i18n import Translation
50
from univention.lib.i18n import Translation
46
from univention.lib import atjobs
51
from univention.lib import atjobs
47
from univention.management.console.log import MODULE
52
from univention.management.console.log import MODULE
48
from univention.management.console.config import ucr
53
from univention.management.console.config import ucr
49
from univention.management.console.modules import Base
54
from univention.management.console.modules import Base, UMC_Error
50
from univention.management.console.modules.decorators import simple_response, sanitize
55
from univention.management.console.modules.decorators import simple_response, sanitize
51
from univention.management.console.modules.sanitizers import ChoicesSanitizer, StringSanitizer, IntegerSanitizer
56
from univention.management.console.modules.sanitizers import ChoicesSanitizer, StringSanitizer, IntegerSanitizer
52
57
 Lines 207-212    Link Here 
207
			MODULE.error("init() ERROR: %s" % (exc,))
212
			MODULE.error("init() ERROR: %s" % (exc,))
208
213
209
	@simple_response
214
	@simple_response
215
	def query_maintenance_information(self):
216
		ucr.load()
217
		version = '{}-{}'.format(ucr.get('version/version'), ucr.get('version/patchlevel', '0'))
218
		try:
219
			url = 'http://updates.software-univention.de/download/ucs-maintenance/{}.yaml'.format(version)
220
			with contextlib.closing(urllib2.urlopen(url)) as f:
221
				status = yaml.load(f)
222
				maintained = str(status.get('maintained')).lower()
223
		except urllib2.HTTPError as e:
224
			raise UMC_Error(e)
225
		else:
226
			udm_modules.update()
227
			lo, po = udm_uldap.getMachineConnection()
228
			result = udm_modules.lookup('settings/license', None, lo, base=ucr['ldap/base'], scope='sub')
229
			if result:
230
				result = result[0]
231
				result.open()
232
				return {
233
						'maintained': maintained,
234
						'baseDN': result.get('base'),
235
						'support': result.get('support'),
236
						'premiumSupport': result.get('premiumsupport')
237
				}
238
239
	@simple_response
210
	def poll(self):
240
	def poll(self):
211
		return True
241
		return True
212
242
(-)univention-updater/umc/updater.xml (+1 lines)
 Lines 24-29    Link Here 
24
		<command name="updater/updates/available" function="updates_available"/>
24
		<command name="updater/updates/available" function="updates_available"/>
25
		<!-- CHECK: return a list of packages eligible for update/install/remove -->
25
		<!-- CHECK: return a list of packages eligible for update/install/remove -->
26
		<command name="updater/updates/check" function="updates_check"/>
26
		<command name="updater/updates/check" function="updates_check"/>
27
		<command name="updater/maintenance_information" function="query_maintenance_information"/>
27
28
28
		<!--
29
		<!--
29
		ONLINE/INSTALLER namespace:
30
		ONLINE/INSTALLER namespace:

Return to bug 43026