Merge lp:~ltrager/maas/global_min_hwe_kernel into lp:~maas-committers/maas/trunk

Proposed by Lee Trager
Status: Merged
Approved by: Lee Trager
Approved revision: no longer in the source branch.
Merged at revision: 4406
Proposed branch: lp:~ltrager/maas/global_min_hwe_kernel
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 367 lines (+140/-5)
12 files modified
src/maasserver/api/pxeconfig.py (+12/-1)
src/maasserver/api/tests/test_pxeconfig.py (+20/-0)
src/maasserver/forms.py (+7/-1)
src/maasserver/forms_settings.py (+39/-0)
src/maasserver/models/config.py (+1/-0)
src/maasserver/models/node.py (+6/-0)
src/maasserver/models/tests/test_node.py (+14/-0)
src/maasserver/static/js/angular/controllers/add_hardware.js (+3/-1)
src/maasserver/static/js/angular/factories/general.js (+10/-0)
src/maasserver/static/js/angular/factories/tests/test_general.js (+15/-2)
src/maasserver/tests/test_forms_commissioning.py (+8/-0)
src/maasserver/websockets/handlers/general.py (+5/-0)
To merge this branch: bzr merge lp:~ltrager/maas/global_min_hwe_kernel
Reviewer Review Type Date Requested Status
Blake Rouse (community) Approve
Andres Rodriguez (community) Needs Information
Review via email: mp+275477@code.launchpad.net

Commit message

Add global_min_hwe_kernel which is used to set the min_hwe_kernel on new nodes. min_hwe_kernel requirements are now followed during commissioning and enlistment.

Description of the change

This branch adds the global_min_hwe_kernel option to MAAS. When set new nodes, or nodes which are being recommissioned which do not have min_hwe_kernel set, will have min_hwe_kernel set to global_min_hwe_kernel automatically.

This branch also instructions MAAS to follow any requirements set by min_hwe_kernel during commissioning and enlistment. Because min_hwe_kernel is now used during enlistment and commissioning global_min_hwe_kernel is limited to the hwe kernels available with the commissioning release. The user can set min_hwe_kernel when adding a new node in the UI or command line or by setting the new global_min_hwe_kernel option.

To post a comment you must log in.
Revision history for this message
Blake Rouse (blake-rouse) wrote :

The core looks good. But needs to fix some things. See inline.

review: Needs Fixing
Revision history for this message
Lee Trager (ltrager) wrote :

Thanks for the review, I've fixed the items you marked below.

Revision history for this message
Andres Rodriguez (andreserl) wrote :

Hi Lee,

I have a couple things:

1. I think that solely using min_hwe_kernel can be very confusing to the user, which is why global_min_hwe_kernel was better. I disagree with Blake's comment here really. We can discuss this in the call.

2. see inline

review: Needs Fixing
Revision history for this message
Andres Rodriguez (andreserl) wrote :

nevermind comment 2. I'd only like to discuss the global_min_hwe_kernel, or it should at least be default_min_hwe_kernel

review: Needs Information
Revision history for this message
Blake Rouse (blake-rouse) wrote :

I am good with default_min_hwe_kernel. That will make it consistent.
"global_" was not consistent.

On Fri, Oct 23, 2015 at 11:38 AM, Andres Rodriguez <email address hidden>
wrote:

> Review: Needs Information
>
> nevermind comment 2. I'd only like to discuss the global_min_hwe_kernel,
> or it should at least be default_min_hwe_kernel
>
> Diff comments:
>
> > === modified file 'src/maasserver/api/pxeconfig.py'
> > --- src/maasserver/api/pxeconfig.py 2015-09-08 18:41:57 +0000
> > +++ src/maasserver/api/pxeconfig.py 2015-10-23 07:37:11 +0000
> > @@ -227,6 +227,10 @@
> > # we give precedence to any kernel defined in the
> subarchitecture field
> > if subarch == "generic" and node.hwe_kernel:
> > subarch = node.hwe_kernel
> > + elif(subarch == "generic"
> > + and node.get_boot_purpose() == "commissioning"
> > + and node.min_hwe_kernel):
> > + subarch = node.min_hwe_kernel
>
> nevermind this comment, I see in the code belowe this is being addressed
>
> > else:
> > nodegroup = find_nodegroup_for_pxeconfig_request(request)
> > preseed_url =
> compose_enlistment_preseed_url(nodegroup=nodegroup)
>
>
> --
>
> https://code.launchpad.net/~ltrager/maas/global_min_hwe_kernel/+merge/275477
> You are reviewing the proposed merge of
> lp:~ltrager/maas/global_min_hwe_kernel into lp:maas.
>

Revision history for this message
Blake Rouse (blake-rouse) wrote :

Looks good. Thanks for all the fixes.

review: Approve
Revision history for this message
MAAS Lander (maas-lander) wrote :
Download full text (996.5 KiB)

The attempt to merge lp:~ltrager/maas/global_min_hwe_kernel into lp:maas failed. Below is the output from the failed tests.

Hit http://security.ubuntu.com trusty-security InRelease
Ign http://nova.clouds.archive.ubuntu.com trusty InRelease
Get:1 http://nova.clouds.archive.ubuntu.com trusty-updates InRelease [64.4 kB]
Hit http://security.ubuntu.com trusty-security/main Sources
Hit http://security.ubuntu.com trusty-security/universe Sources
Hit http://security.ubuntu.com trusty-security/main amd64 Packages
Hit http://security.ubuntu.com trusty-security/universe amd64 Packages
Hit http://security.ubuntu.com trusty-security/main Translation-en
Hit http://security.ubuntu.com trusty-security/universe Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty Release.gpg
Hit http://nova.clouds.archive.ubuntu.com trusty Release
Get:2 http://nova.clouds.archive.ubuntu.com trusty-updates/main Sources [240 kB]
Get:3 http://nova.clouds.archive.ubuntu.com trusty-updates/universe Sources [140 kB]
Get:4 http://nova.clouds.archive.ubuntu.com trusty-updates/main amd64 Packages [635 kB]
Get:5 http://nova.clouds.archive.ubuntu.com trusty-updates/universe amd64 Packages [323 kB]
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/universe Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty/main Sources
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Sources
Hit http://nova.clouds.archive.ubuntu.com trusty/main amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/universe amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en
Ign http://nova.clouds.archive.ubuntu.com trusty/main Translation-en_US
Ign http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en_US
Fetched 1,403 kB in 3s (372 kB/s)
Reading package lists...
sudo DEBIAN_FRONTEND=noninteractive apt-get -y \
     --no-install-recommends install apache2 authbind bind9 bind9utils build-essential bzr-builddeb chromium-browser chromium-chromedriver curl daemontools debhelper dh-apport dh-systemd distro-info dnsutils firefox freeipmi-tools git gjs ipython isc-dhcp-common libjs-angularjs libjs-jquery libjs-jquery-hotkeys libjs-yui3-full libjs-yui3-min libpq-dev make nodejs-legacy npm pep8 phantomjs postgresql pyflakes python-apt python-bson python-bzrlib python-convoy python-coverage python-crochet python-cssselect python-curtin python-dev python-distro-info python-django python-django-piston python-django-south python-djorm-ext-pgarray python-docutils python-extras python-fixtures python-flake8 python-formencode python-hivex python-httplib2 python-jinja2 python-jsonschema python-lxml python-mock python-netaddr python-netifaces python-nose python-oauth python-openssl python-paramiko python-pexpect python-pip python-pocket-lint python-psycopg2 python-pyinotify python-pyparsing python-seamicroclient python-simplejson python-simplestreams python-sphinx python-subunit python-tempita python-testresources python-testscenarios python-testtools python-twisted python-txtftp python-tz python...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/maasserver/api/pxeconfig.py'
--- src/maasserver/api/pxeconfig.py 2015-09-08 18:41:57 +0000
+++ src/maasserver/api/pxeconfig.py 2015-10-23 17:54:22 +0000
@@ -227,6 +227,10 @@
227 # we give precedence to any kernel defined in the subarchitecture field227 # we give precedence to any kernel defined in the subarchitecture field
228 if subarch == "generic" and node.hwe_kernel:228 if subarch == "generic" and node.hwe_kernel:
229 subarch = node.hwe_kernel229 subarch = node.hwe_kernel
230 elif(subarch == "generic"
231 and node.get_boot_purpose() == "commissioning"
232 and node.min_hwe_kernel):
233 subarch = node.min_hwe_kernel
230 else:234 else:
231 nodegroup = find_nodegroup_for_pxeconfig_request(request)235 nodegroup = find_nodegroup_for_pxeconfig_request(request)
232 preseed_url = compose_enlistment_preseed_url(nodegroup=nodegroup)236 preseed_url = compose_enlistment_preseed_url(nodegroup=nodegroup)
@@ -254,7 +258,14 @@
254 else:258 else:
255 arch, _ = resource.split_arch()259 arch, _ = resource.split_arch()
256260
257 subarch = get_optional_param(request.GET, 'subarch', 'generic')261 default_min_hwe_kernel = Config.objects.get_config(
262 'default_min_hwe_kernel')
263 if default_min_hwe_kernel:
264 subarch = get_optional_param(
265 request.GET, 'subarch', default_min_hwe_kernel)
266 else:
267 subarch = get_optional_param(
268 request.GET, 'subarch', 'generic')
258269
259 # If we are booting with "xinstall", then we should always return the270 # If we are booting with "xinstall", then we should always return the
260 # commissioning operating system and distro_series.271 # commissioning operating system and distro_series.
261272
=== modified file 'src/maasserver/api/tests/test_pxeconfig.py'
--- src/maasserver/api/tests/test_pxeconfig.py 2015-08-29 03:27:16 +0000
+++ src/maasserver/api/tests/test_pxeconfig.py 2015-10-23 17:54:22 +0000
@@ -361,6 +361,15 @@
361 (ip, hostname),361 (ip, hostname),
362 (json.loads(response.content)["log_host"], mock.call_args[0][0]))362 (json.loads(response.content)["log_host"], mock.call_args[0][0]))
363363
364 def test_pxeconfig_enlistment_checks_default_min_hwe_kernel(self):
365 params = self.get_default_params()
366 params['arch'] = 'armhf'
367 Config.objects.set_config('default_min_hwe_kernel', 'hwe-v')
368 response = self.client.get(reverse('pxeconfig'), params)
369 self.assertEqual(
370 "hwe-v",
371 json.loads(response.content)["subarch"])
372
364 def test_pxeconfig_has_preseed_url_for_known_node(self):373 def test_pxeconfig_has_preseed_url_for_known_node(self):
365 params = self.get_mac_params()374 params = self.get_mac_params()
366 node = Interface.objects.get(mac_address=params['mac']).node375 node = Interface.objects.get(mac_address=params['mac']).node
@@ -631,6 +640,17 @@
631 self.assertEqual(osystem, params_out["osystem"])640 self.assertEqual(osystem, params_out["osystem"])
632 self.assertEqual(release, params_out["release"])641 self.assertEqual(release, params_out["release"])
633642
643 def test_pxeconfig_commissioning_node_uses_min_hwe_kernel(self):
644 node = factory.make_Node(min_hwe_kernel="hwe-v")
645 nic = factory.make_Interface(INTERFACE_TYPE.PHYSICAL, node=node)
646 self.patch(Node, 'get_boot_purpose').return_value = "commissioning"
647 params = self.get_default_params()
648 params['mac'] = nic.mac_address
649 response = self.client.get(reverse('pxeconfig'), params)
650 self.assertEqual(
651 "hwe-v",
652 json.loads(response.content)["subarch"])
653
634 def test_pxeconfig_returns_ubuntu_os_series_for_ubuntu_xinstall(self):654 def test_pxeconfig_returns_ubuntu_os_series_for_ubuntu_xinstall(self):
635 nodegroup = factory.make_NodeGroup()655 nodegroup = factory.make_NodeGroup()
636 ubuntu_image = make_rpc_boot_image(656 ubuntu_image = make_rpc_boot_image(
637657
=== modified file 'src/maasserver/forms.py'
--- src/maasserver/forms.py 2015-10-21 23:36:45 +0000
+++ src/maasserver/forms.py 2015-10-23 17:54:22 +0000
@@ -566,7 +566,11 @@
566 return boot_type566 return boot_type
567567
568 def clean_min_hwe_kernel(self):568 def clean_min_hwe_kernel(self):
569 return validate_min_hwe_kernel(self.cleaned_data.get('min_hwe_kernel'))569 min_hwe_kernel = self.cleaned_data.get('min_hwe_kernel')
570 if self.new_node and not min_hwe_kernel:
571 min_hwe_kernel = Config.objects.get_config(
572 'default_min_hwe_kernel')
573 return validate_min_hwe_kernel(min_hwe_kernel)
570574
571 def clean(self):575 def clean(self):
572 cleaned_data = super(NodeForm, self).clean()576 cleaned_data = super(NodeForm, self).clean()
@@ -1306,6 +1310,8 @@
1306 Form.__init__(self, *args, **kwargs)1310 Form.__init__(self, *args, **kwargs)
1307 self.fields['commissioning_distro_series'] = get_config_field(1311 self.fields['commissioning_distro_series'] = get_config_field(
1308 'commissioning_distro_series')1312 'commissioning_distro_series')
1313 self.fields['default_min_hwe_kernel'] = get_config_field(
1314 'default_min_hwe_kernel')
1309 self._load_initials()1315 self._load_initials()
13101316
13111317
13121318
=== modified file 'src/maasserver/forms_settings.py'
--- src/maasserver/forms_settings.py 2015-08-18 18:02:11 +0000
+++ src/maasserver/forms_settings.py 2015-10-23 17:54:22 +0000
@@ -27,6 +27,7 @@
27from django.core.exceptions import ValidationError27from django.core.exceptions import ValidationError
28from maasserver.bootresources import IMPORT_RESOURCES_SERVICE_PERIOD28from maasserver.bootresources import IMPORT_RESOURCES_SERVICE_PERIOD
29from maasserver.fields import IPListFormField29from maasserver.fields import IPListFormField
30from maasserver.models import BootResource
30from maasserver.models.config import (31from maasserver.models.config import (
31 Config,32 Config,
32 DEFAULT_OS,33 DEFAULT_OS,
@@ -39,6 +40,7 @@
39 list_all_usable_releases,40 list_all_usable_releases,
40 list_commissioning_choices,41 list_commissioning_choices,
41 list_osystem_choices,42 list_osystem_choices,
43 release_a_newer_than_b,
42)44)
4345
4446
@@ -114,6 +116,31 @@
114 return field116 return field
115117
116118
119def make_default_min_hwe_kernel_field(*args, **kwargs):
120 """Build and return the default_min_hwe_kernel field."""
121 kernel_choices = [('', '--- No minimum kernel ---')]
122 # Global choices are limited to the commissioning release as min_hwe_kernel
123 # is used during commissioning.
124 commissioning_series = Config.objects.get_config(
125 'commissioning_distro_series')
126 if commissioning_series:
127 commissioning_os_release = "ubuntu/" + commissioning_series
128 kernel_choices += [
129 (kernel, kernel)
130 for kernel in BootResource.objects.get_usable_hwe_kernels(
131 commissioning_os_release)
132 if release_a_newer_than_b(kernel, commissioning_series)]
133 field = forms.ChoiceField(
134 initial=Config.objects.get_config('default_min_hwe_kernel'),
135 choices=kernel_choices,
136 error_messages={
137 'invalid_choice': compose_invalid_choice_text(
138 'default_min_hwe_kernel', kernel_choices)
139 },
140 **kwargs)
141 return field
142
143
117def make_commissioning_distro_series_field(*args, **kwargs):144def make_commissioning_distro_series_field(*args, **kwargs):
118 """Build and return the commissioning_distro_series field."""145 """Build and return the commissioning_distro_series field."""
119 usable_oses = list_all_usable_osystems()146 usable_oses = list_all_usable_osystems()
@@ -257,6 +284,18 @@
257 # at run-time to avoid a race condition.284 # at run-time to avoid a race condition.
258 }285 }
259 },286 },
287 'default_min_hwe_kernel': {
288 'default': None,
289 'form': make_default_min_hwe_kernel_field,
290 'form_kwargs': {
291 'label': "Default Minimum Kernel Version",
292 'required': False,
293 'help_text': (
294 "The default minimum kernel version used on all new and"
295 " commissioned nodes."
296 )
297 }
298 },
260 'default_storage_layout': {299 'default_storage_layout': {
261 'default': 'lvm',300 'default': 'lvm',
262 'form': forms.ChoiceField,301 'form': forms.ChoiceField,
263302
=== modified file 'src/maasserver/models/config.py'
--- src/maasserver/models/config.py 2015-08-18 18:02:11 +0000
+++ src/maasserver/models/config.py 2015-10-23 17:54:22 +0000
@@ -51,6 +51,7 @@
51 'commissioning_osystem': DEFAULT_OS.name,51 'commissioning_osystem': DEFAULT_OS.name,
52 'commissioning_distro_series':52 'commissioning_distro_series':
53 DEFAULT_OS.get_default_commissioning_release(),53 DEFAULT_OS.get_default_commissioning_release(),
54 'default_min_hwe_kernel': '',
54 'default_storage_layout': 'lvm',55 'default_storage_layout': 'lvm',
55 # Network section configuration.56 # Network section configuration.
56 'maas_name': gethostname(),57 'maas_name': gethostname(),
5758
=== modified file 'src/maasserver/models/node.py'
--- src/maasserver/models/node.py 2015-10-21 00:43:01 +0000
+++ src/maasserver/models/node.py 2015-10-23 17:54:22 +0000
@@ -998,6 +998,12 @@
998 old_status = self.status998 old_status = self.status
999 self.status = NODE_STATUS.COMMISSIONING999 self.status = NODE_STATUS.COMMISSIONING
1000 self.owner = user1000 self.owner = user
1001 # Set min_hwe_kernel to min_hwe_kernel if it isn't set incase
1002 # commissioning failed and the user set the min globally and is
1003 # retrying.
1004 if not self.min_hwe_kernel:
1005 self.min_hwe_kernel = Config.objects.get_config(
1006 'default_min_hwe_kernel')
1001 self.save()1007 self.save()
10021008
1003 # Prepare a transition monitor for later.1009 # Prepare a transition monitor for later.
10041010
=== modified file 'src/maasserver/models/tests/test_node.py'
--- src/maasserver/models/tests/test_node.py 2015-10-21 00:43:01 +0000
+++ src/maasserver/models/tests/test_node.py 2015-10-23 17:54:22 +0000
@@ -1492,6 +1492,20 @@
1492 post_commit_hooks.reset() # Ignore these for now.1492 post_commit_hooks.reset() # Ignore these for now.
1493 self.assertThat(node_start, MockCalledOnceWith(admin, user_data))1493 self.assertThat(node_start, MockCalledOnceWith(admin, user_data))
14941494
1495 def test_start_commissioning_sets_min_hwe_kernel(self):
1496 node = factory.make_Node(status=NODE_STATUS.NEW)
1497 node_start = self.patch(node, '_start')
1498 node_start.side_effect = lambda user, user_data: post_commit()
1499 user_data = factory.make_string().encode('ascii')
1500 generate_user_data = self.patch(
1501 commissioning, 'generate_user_data')
1502 generate_user_data.return_value = user_data
1503 admin = factory.make_admin()
1504 Config.objects.set_config('default_min_hwe_kernel', 'hwe-v')
1505 node.start_commissioning(admin)
1506 post_commit_hooks.reset() # Ignore these for now.
1507 self.assertEqual('hwe-v', node.min_hwe_kernel)
1508
1495 def test_start_commissioning_clears_node_commissioning_results(self):1509 def test_start_commissioning_clears_node_commissioning_results(self):
1496 node = factory.make_Node(status=NODE_STATUS.NEW)1510 node = factory.make_Node(status=NODE_STATUS.NEW)
1497 NodeResult.objects.store_data(1511 NodeResult.objects.store_data(
14981512
=== modified file 'src/maasserver/static/js/angular/controllers/add_hardware.js'
--- src/maasserver/static/js/angular/controllers/add_hardware.js 2015-08-11 15:07:10 +0000
+++ src/maasserver/static/js/angular/controllers/add_hardware.js 2015-10-23 17:54:22 +0000
@@ -24,6 +24,8 @@
24 $scope.zones = ZonesManager.getItems();24 $scope.zones = ZonesManager.getItems();
25 $scope.architectures = GeneralManager.getData("architectures");25 $scope.architectures = GeneralManager.getData("architectures");
26 $scope.hwe_kernels = GeneralManager.getData("hwe_kernels");26 $scope.hwe_kernels = GeneralManager.getData("hwe_kernels");
27 $scope.default_min_hwe_kernel = GeneralManager.getData(
28 "default_min_hwe_kernel");
27 $scope.error = null;29 $scope.error = null;
2830
29 // Input values.31 // Input values.
@@ -281,6 +283,7 @@
281 macs: [newMAC()],283 macs: [newMAC()],
282 zone: defaultZone(),284 zone: defaultZone(),
283 architecture: defaultArchitecture(),285 architecture: defaultArchitecture(),
286 min_hwe_kernel: $scope.default_min_hwe_kernel.text,
284 power: {287 power: {
285 type: null,288 type: null,
286 parameters: {}289 parameters: {}
@@ -439,7 +442,6 @@
439 $scope.machine.cluster === null ||442 $scope.machine.cluster === null ||
440 $scope.machine.zone === null ||443 $scope.machine.zone === null ||
441 $scope.machine.architecture === '' ||444 $scope.machine.architecture === '' ||
442 $scope.machine.min_hwe_kernel === '' ||
443 $scope.machine.power.type === null ||445 $scope.machine.power.type === null ||
444 $scope.invalidName($scope.machine));446 $scope.invalidName($scope.machine));
445 if(in_error) {447 if(in_error) {
446448
=== modified file 'src/maasserver/static/js/angular/factories/general.js'
--- src/maasserver/static/js/angular/factories/general.js 2015-10-21 19:45:50 +0000
+++ src/maasserver/static/js/angular/factories/general.js 2015-10-23 17:54:22 +0000
@@ -49,6 +49,16 @@
49 polling: false,49 polling: false,
50 nextPromise: null50 nextPromise: null
51 },51 },
52 default_min_hwe_kernel: {
53 method: "general.default_min_hwe_kernel",
54 data: { text: '' },
55 loaded: false,
56 polling: false,
57 nextPromise: null,
58 replaceData: function(oldData, newData) {
59 oldData.text = newData;
60 }
61 },
52 osinfo: {62 osinfo: {
53 method: "general.osinfo",63 method: "general.osinfo",
54 data: {},64 data: {},
5565
=== modified file 'src/maasserver/static/js/angular/factories/tests/test_general.js'
--- src/maasserver/static/js/angular/factories/tests/test_general.js 2015-10-21 19:45:50 +0000
+++ src/maasserver/static/js/angular/factories/tests/test_general.js 2015-10-23 17:54:22 +0000
@@ -51,7 +51,7 @@
51 it("_data has expected keys", function() {51 it("_data has expected keys", function() {
52 expect(Object.keys(GeneralManager._data)).toEqual(52 expect(Object.keys(GeneralManager._data)).toEqual(
53 ["node_actions", "device_actions", "architectures", "hwe_kernels",53 ["node_actions", "device_actions", "architectures", "hwe_kernels",
54 "osinfo", "bond_options", "version"]);54 "default_min_hwe_kernel", "osinfo", "bond_options", "version"]);
55 });55 });
5656
57 it("_data.node_actions has correct data", function() {57 it("_data.node_actions has correct data", function() {
@@ -90,6 +90,17 @@
90 expect(hwe_kernels.nextPromise).toBeNull();90 expect(hwe_kernels.nextPromise).toBeNull();
91 });91 });
9292
93 it("_data.default_min_hwe_kernels has correct data", function() {
94 var default_min_hwe_kernel =
95 GeneralManager._data.default_min_hwe_kernel;
96 expect(default_min_hwe_kernel.method).toBe(
97 "general.default_min_hwe_kernel");
98 expect(default_min_hwe_kernel.data).toEqual({text: ''});
99 expect(default_min_hwe_kernel.loaded).toBe(false);
100 expect(default_min_hwe_kernel.polling).toBe(false);
101 expect(default_min_hwe_kernel.nextPromise).toBeNull();
102 });
103
93 it("_data.osinfo has correct data", function() {104 it("_data.osinfo has correct data", function() {
94 var osinfo = GeneralManager._data.osinfo;105 var osinfo = GeneralManager._data.osinfo;
95 expect(osinfo.method).toBe("general.osinfo");106 expect(osinfo.method).toBe("general.osinfo");
@@ -166,6 +177,7 @@
166 GeneralManager._data.device_actions.loaded = true;177 GeneralManager._data.device_actions.loaded = true;
167 GeneralManager._data.architectures.loaded = true;178 GeneralManager._data.architectures.loaded = true;
168 GeneralManager._data.hwe_kernels.loaded = true;179 GeneralManager._data.hwe_kernels.loaded = true;
180 GeneralManager._data.default_min_hwe_kernel.loaded = true;
169 GeneralManager._data.osinfo.loaded = true;181 GeneralManager._data.osinfo.loaded = true;
170 GeneralManager._data.bond_options.loaded = true;182 GeneralManager._data.bond_options.loaded = true;
171 GeneralManager._data.version.loaded = true;183 GeneralManager._data.version.loaded = true;
@@ -416,7 +428,7 @@
416 spyOn(GeneralManager, "_loadData").and.returnValue(428 spyOn(GeneralManager, "_loadData").and.returnValue(
417 $q.defer().promise);429 $q.defer().promise);
418 GeneralManager.loadItems();430 GeneralManager.loadItems();
419 expect(GeneralManager._loadData.calls.count()).toBe(7);431 expect(GeneralManager._loadData.calls.count()).toBe(8);
420 });432 });
421433
422 it("resolve defer once all resolve", function(done) {434 it("resolve defer once all resolve", function(done) {
@@ -427,6 +439,7 @@
427 $q.defer(),439 $q.defer(),
428 $q.defer(),440 $q.defer(),
429 $q.defer(),441 $q.defer(),
442 $q.defer(),
430 $q.defer()443 $q.defer()
431 ];444 ];
432 var i = 0;445 var i = 0;
433446
=== modified file 'src/maasserver/tests/test_forms_commissioning.py'
--- src/maasserver/tests/test_forms_commissioning.py 2015-05-07 18:14:38 +0000
+++ src/maasserver/tests/test_forms_commissioning.py 2015-10-23 17:54:22 +0000
@@ -36,6 +36,14 @@
36 'commissioning_distro_series', field.choices),36 'commissioning_distro_series', field.choices),
37 field.error_messages['invalid_choice'])37 field.error_messages['invalid_choice'])
3838
39 def test_commissioningform_error_msg_lists_min_hwe_kernel_choices(self):
40 form = CommissioningForm()
41 field = form.fields['default_min_hwe_kernel']
42 self.assertEqual(
43 compose_invalid_choice_text(
44 'default_min_hwe_kernel', field.choices),
45 field.error_messages['invalid_choice'])
46
3947
40class TestCommissioningScriptForm(MAASServerTestCase):48class TestCommissioningScriptForm(MAASServerTestCase):
4149
4250
=== modified file 'src/maasserver/websockets/handlers/general.py'
--- src/maasserver/websockets/handlers/general.py 2015-10-21 19:45:50 +0000
+++ src/maasserver/websockets/handlers/general.py 2015-10-23 17:54:22 +0000
@@ -45,6 +45,7 @@
45 allowed_methods = [45 allowed_methods = [
46 'architectures',46 'architectures',
47 'hwe_kernels',47 'hwe_kernels',
48 'default_min_hwe_kernel',
48 'osinfo',49 'osinfo',
49 'node_actions',50 'node_actions',
50 'device_actions',51 'device_actions',
@@ -61,6 +62,10 @@
61 """Return all supported hwe_kernels."""62 """Return all supported hwe_kernels."""
62 return BootResource.objects.get_usable_hwe_kernels()63 return BootResource.objects.get_usable_hwe_kernels()
6364
65 def default_min_hwe_kernel(self, params):
66 """Return the default_min_hwe_kernel."""
67 return Config.objects.get_config('default_min_hwe_kernel')
68
64 def osinfo(self, params):69 def osinfo(self, params):
65 """Return all available operating systems and releases information."""70 """Return all available operating systems and releases information."""
66 osystems = list_all_usable_osystems()71 osystems = list_all_usable_osystems()