Index: univention-updater/debian/control
===================================================================
--- univention-updater/debian/control (Revision 75335)
+++ univention-updater/debian/control (Arbeitskopie)
@@ -8,6 +8,7 @@
python-support (>= 0.90),
python-debian,
python-apt,
+ python-yaml,
ucslint-univention,
univention-management-console-dev
XS-Python-Version: 2.6, 2.7
@@ -24,6 +25,7 @@
python-univention-lib (>= 1.0.25-1),
python-debian,
python-apt,
+ python-yaml,
univention-errata-level,
apt-transport-https,
ca-certificates,
Index: univention-updater/umc/js/updater/UpdatesPage.js
===================================================================
--- univention-updater/umc/js/updater/UpdatesPage.js (Revision 75335)
+++ univention-updater/umc/js/updater/UpdatesPage.js (Arbeitskopie)
@@ -36,6 +36,7 @@
"dojo/dom-class",
"dojo/topic",
"dojo/Deferred",
+ "dijit/registry",
"dojox/string/sprintf",
"umc/app",
"umc/tools",
@@ -48,7 +49,16 @@
"umc/modules/updater/Page",
"umc/modules/updater/Form",
"umc/i18n!umc/modules/updater"
-], function(declare, lang, array, all, domClass, topic, Deferred, sprintf, UMCApplication, tools, store, server, TitlePane, Text, HiddenInput, ComboBox, Page, Form, _) {
+], function(declare, lang, array, all, domClass, topic, Deferred, dijitRegistry, sprintf, UMCApplication, tools, store, server, TitlePane, Text, HiddenInput, ComboBox, Page, Form, _) {
+ var _getParentWidget = function(widget) {
+ try {
+ return dijitRegistry.getEnclosingWidget(widget.domNode.parentNode);
+ } catch(e) {
+ // could not access _widget.domNode.parentNode
+ return null;
+ }
+ };
+
return declare("umc.modules.updater.UpdatesPage", Page, {
_update_prohibited: false,
@@ -66,6 +76,21 @@
});
},
+ _getEnclosingTitlePane: function(widgetName) {
+ var _widget = this._form.getWidget(widgetName) || this._form.getButton(widgetName);
+ while (_widget != null) {
+ if (_widget.isInstanceOf(TitlePane)) {
+ // we successfully found the enclosing TitlePane of the given widget
+ return _widget;
+ }
+ if (_widget.isInstanceOf(Form)) {
+ // do not search beyond the form widget
+ return null;
+ }
+ _widget = _getParentWidget(_widget);
+ }
+ },
+
buildRendering: function() {
this.inherited(arguments);
@@ -74,6 +99,13 @@
type: HiddenInput,
name: 'reboot_required'
}, {
+ type: 'Text',
+ name: 'version_out_of_maintenance_text',
+ 'class': 'umcUpdaterWarningText',
+ visible: false,
+ label: '',
+ content: '', // will be set below as soon as the UCS version is known
+ }, {
type: Text,
name: 'reboot_text',
label: ' ',
@@ -335,7 +367,9 @@
size: 'One'
}];
- var layout = [{
+ var layout = [
+ 'version_out_of_maintenance_text',
+ {
label: _("Reboot required"),
layout: [
['reboot_text', 'reboot']
@@ -376,10 +410,10 @@
// fetch all known/initial titlepanes and save them with their name
// so they can be used later on
this._titlepanes = {
- reboot: this._form._container.getChildren()[0],
- easymode: this._form._container.getChildren()[1],
- release: this._form._container.getChildren()[2],
- packages: this._form._container.getChildren()[3]
+ reboot: this._getEnclosingTitlePane('reboot'),
+ easymode: this._getEnclosingTitlePane('easy_upgrade'),
+ release: this._getEnclosingTitlePane('run_release_update'),
+ packages: this._getEnclosingTitlePane('run_packages_update')
};
// Before we attach the form to our page, just switch off all title panes.
@@ -433,6 +467,32 @@
this._show_reboot_pane(tools.isTrue(values.reboot_required));
+ // load maintenance information and show message if out of maintenance
+ tools.umcpCommand('updater/maintenance_information').then(lang.hitch(this, function(data) {
+ var info = data.result;
+ var msg = '';
+ if (info.maintained === 'extended') {
+ // TODO add behaviour for extended
+ } else if (info.maintained === 'false') {
+ if (info.baseDN === 'Free for personal use edition' || info.baseDN === 'UCS Core Edition') {
+ 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 Univention Webseite.", []);
+ } else if (info.support == 0 && info.premiumSupport == 0) {
+ msg = '';
+ } else if (info.support == 1 && info.premiumSupport == 0) {
+ msg = '';
+ } else if (info.support == 0 && info.premiumSupport == 1) {
+ msg = '';
+ }
+ }
+
+ if (msg) {
+ var outOfMaintenanceWidget = this._form.getWidget('version_out_of_maintenance_text');
+ outOfMaintenanceWidget.set('content', msg);
+ outOfMaintenanceWidget.set('visible', true);
+ }
+ }));
+
+
} catch(error) {
console.error("onLoaded: " + error.message);
}
@@ -590,6 +650,21 @@
},
+ postCreate: function() {
+ // maintenance status
+ // tools.umcpCommand('updater/maintenance_information').then(function(data) {
+ // var info = data.result;
+ // if (info.maintained === 'extended') {
+ // TODO add behaviour for extended with ucr variable
+ // return;
+ // } else if (info.maintained === 'false') {
+ // if (info.baseDN === 'Free for personal use edition' || info.baseDN === 'UCS Core Edition') {
+ // 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 Univention Webseite.");
+ // }
+ // }
+ // });
+ },
+
// First page refresh doesn't work properly when invoked in 'buildRendering()' so
// we defer it until the UI is being shown
startup: function() {
Index: univention-updater/umc/python/updater/__init__.py
===================================================================
--- univention-updater/umc/python/updater/__init__.py (Revision 75335)
+++ univention-updater/umc/python/updater/__init__.py (Arbeitskopie)
@@ -38,15 +38,20 @@
import subprocess
import psutil
import pipes
+import urllib2
+import contextlib
+import yaml
import univention.hooks
import notifier.threads
+import univention.admin.modules as udm_modules
+import univention.admin.uldap as udm_uldap
from univention.lib.i18n import Translation
from univention.lib import atjobs
from univention.management.console.log import MODULE
from univention.management.console.config import ucr
-from univention.management.console.modules import Base
+from univention.management.console.modules import Base, UMC_Error
from univention.management.console.modules.decorators import simple_response, sanitize
from univention.management.console.modules.sanitizers import ChoicesSanitizer, StringSanitizer, IntegerSanitizer
@@ -207,6 +212,31 @@
MODULE.error("init() ERROR: %s" % (exc,))
@simple_response
+ def query_maintenance_information(self):
+ ucr.load()
+ version = '{}-{}'.format(ucr.get('version/version'), ucr.get('version/patchlevel', '0'))
+ try:
+ url = 'http://updates.software-univention.de/download/ucs-maintenance/{}.yaml'.format(version)
+ with contextlib.closing(urllib2.urlopen(url)) as f:
+ status = yaml.load(f)
+ maintained = str(status.get('maintained')).lower()
+ except urllib2.HTTPError as e:
+ raise UMC_Error(e)
+ else:
+ udm_modules.update()
+ lo, po = udm_uldap.getMachineConnection()
+ result = udm_modules.lookup('settings/license', None, lo, base=ucr['ldap/base'], scope='sub')
+ if result:
+ result = result[0]
+ result.open()
+ return {
+ 'maintained': maintained,
+ 'baseDN': result.get('base'),
+ 'support': result.get('support'),
+ 'premiumSupport': result.get('premiumsupport')
+ }
+
+ @simple_response
def poll(self):
return True
Index: univention-updater/umc/updater.xml
===================================================================
--- univention-updater/umc/updater.xml (Revision 75335)
+++ univention-updater/umc/updater.xml (Arbeitskopie)
@@ -24,6 +24,7 @@
+