Merge lp:~rvb/maas/di-api-bug-1456969-1.7 into lp:maas/1.7

Proposed by Raphaël Badin
Status: Merged
Approved by: Raphaël Badin
Approved revision: no longer in the source branch.
Merged at revision: 3369
Proposed branch: lp:~rvb/maas/di-api-bug-1456969-1.7
Merge into: lp:maas/1.7
Diff against target: 252 lines (+69/-5)
7 files modified
docs/changelog.rst (+9/-0)
src/maasserver/api/nodes.py (+11/-1)
src/maasserver/api/tests/test_enlistment.py (+4/-1)
src/maasserver/api/tests/test_node.py (+23/-0)
src/maasserver/forms.py (+13/-0)
src/maasserver/testing/factory.py (+7/-3)
src/maasserver/tests/test_forms_node.py (+2/-0)
To merge this branch: bzr merge lp:~rvb/maas/di-api-bug-1456969-1.7
Reviewer Review Type Date Requested Status
Blake Rouse (community) Approve
Review via email: mp+260172@code.launchpad.net

Commit message

Backport 3921: Expose the 'boot_type' field on the API. This controls whether the node will use curtin or di to install itself. The di installation is deprecated but before we fully support advanced networking and storage configuration in curtin, we still have to support di.

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'docs/changelog.rst'
--- docs/changelog.rst 2015-05-21 17:35:36 +0000
+++ docs/changelog.rst 2015-05-26 16:37:00 +0000
@@ -2,6 +2,15 @@
2Changelog2Changelog
3=========3=========
44
51.7.5
6=====
7
8Bug Fix Update
9--------------
10
11#1456969 MAAS cli/API: missing option set use-fast-installer /
12 use-debian-installer
13
51.7.4141.7.4
6=====15=====
716
817
=== modified file 'src/maasserver/api/nodes.py'
--- src/maasserver/api/nodes.py 2015-03-06 18:23:33 +0000
+++ src/maasserver/api/nodes.py 2015-05-26 16:37:00 +0000
@@ -100,6 +100,7 @@
100 'substatus',100 'substatus',
101 'osystem',101 'osystem',
102 'distro_series',102 'distro_series',
103 'boot_type',
103 'netboot',104 'netboot',
104 'power_type',105 'power_type',
105 'power_state',106 'power_state',
@@ -235,6 +236,11 @@
235 :type power_parameters_skip_check: unicode236 :type power_parameters_skip_check: unicode
236 :param zone: Name of a valid physical zone in which to place this node237 :param zone: Name of a valid physical zone in which to place this node
237 :type zone: unicode238 :type zone: unicode
239 :param boot_type: The installation type of the node. 'fastpath': use
240 the default installer. 'di' use the debian installer.
241 Note that using 'di' is now deprecated and will be removed in favor
242 of the default installer in MAAS 1.9.
243 :type boot_type: unicode
238244
239 Returns 404 if the node is node found.245 Returns 404 if the node is node found.
240 Returns 403 if the user does not have permission to update the node.246 Returns 403 if the user does not have permission to update the node.
@@ -243,7 +249,6 @@
243 system_id=system_id, user=request.user, perm=NODE_PERMISSION.EDIT)249 system_id=system_id, user=request.user, perm=NODE_PERMISSION.EDIT)
244 Form = get_node_edit_form(request.user)250 Form = get_node_edit_form(request.user)
245 form = Form(data=request.data, instance=node)251 form = Form(data=request.data, instance=node)
246
247 if form.is_valid():252 if form.is_valid():
248 return form.save()253 return form.save()
249 else:254 else:
@@ -689,6 +694,11 @@
689 and re-install its operating system. In anonymous enlistment and when694 and re-install its operating system. In anonymous enlistment and when
690 the enlistment is done by a non-admin, the node is held in the695 the enlistment is done by a non-admin, the node is held in the
691 "New" state for approval by a MAAS admin.696 "New" state for approval by a MAAS admin.
697 :param boot_type: The installation type of the node. 'fastpath': use
698 the default installer. 'di' use the debian installer.
699 Note that using 'di' is now deprecated and will be removed in favor
700 of the default installer in MAAS 1.9.
701 :type boot_type: unicode
692 """702 """
693 # XXX 2014-02-11 bug=1278685703 # XXX 2014-02-11 bug=1278685
694 # There's no documentation here on what parameters can be passed!704 # There's no documentation here on what parameters can be passed!
695705
=== modified file 'src/maasserver/api/tests/test_enlistment.py'
--- src/maasserver/api/tests/test_enlistment.py 2014-12-02 16:47:25 +0000
+++ src/maasserver/api/tests/test_enlistment.py 2015-05-26 16:37:00 +0000
@@ -479,7 +479,7 @@
479 'architecture': make_usable_architecture(self),479 'architecture': make_usable_architecture(self),
480 'mac_addresses': ['aa:bb:cc:dd:ee:ff'],480 'mac_addresses': ['aa:bb:cc:dd:ee:ff'],
481 })481 })
482 self.assertEqual(httplib.OK, response.status_code)482 self.assertEqual(httplib.OK, response.status_code, response.content)
483 system_id = json.loads(response.content)['system_id']483 system_id = json.loads(response.content)['system_id']
484 self.assertEqual(484 self.assertEqual(
485 NODE_STATUS.NEW,485 NODE_STATUS.NEW,
@@ -526,6 +526,7 @@
526 'osystem',526 'osystem',
527 'distro_series',527 'distro_series',
528 'netboot',528 'netboot',
529 'boot_type',
529 'power_type',530 'power_type',
530 'power_state',531 'power_state',
531 'tag_names',532 'tag_names',
@@ -622,6 +623,7 @@
622 'osystem',623 'osystem',
623 'distro_series',624 'distro_series',
624 'netboot',625 'netboot',
626 'boot_type',
625 'power_type',627 'power_type',
626 'power_state',628 'power_state',
627 'resource_uri',629 'resource_uri',
@@ -772,6 +774,7 @@
772 'osystem',774 'osystem',
773 'distro_series',775 'distro_series',
774 'netboot',776 'netboot',
777 'boot_type',
775 'power_type',778 'power_type',
776 'power_state',779 'power_state',
777 'resource_uri',780 'resource_uri',
778781
=== modified file 'src/maasserver/api/tests/test_node.py'
--- src/maasserver/api/tests/test_node.py 2015-03-06 18:23:33 +0000
+++ src/maasserver/api/tests/test_node.py 2015-05-26 16:37:00 +0000
@@ -26,6 +26,7 @@
26from maasserver.api import nodes as api_nodes26from maasserver.api import nodes as api_nodes
27from maasserver.enum import (27from maasserver.enum import (
28 IPADDRESS_TYPE,28 IPADDRESS_TYPE,
29 NODE_BOOT,
29 NODE_STATUS,30 NODE_STATUS,
30 NODE_STATUS_CHOICES,31 NODE_STATUS_CHOICES,
31 POWER_STATE,32 POWER_STATE,
@@ -184,6 +185,14 @@
184 parsed_result['zone']['name'],185 parsed_result['zone']['name'],
185 parsed_result['zone']['description']])186 parsed_result['zone']['description']])
186187
188 def test_GET_returns_boot_type(self):
189 node = factory.make_Node()
190 response = self.client.get(self.get_node_uri(node))
191 self.assertEqual(httplib.OK, response.status_code)
192 parsed_result = json.loads(response.content)
193 self.assertEqual(
194 node.boot_type, parsed_result['boot_type'])
195
187 def test_GET_refuses_to_access_nonexistent_node(self):196 def test_GET_refuses_to_access_nonexistent_node(self):
188 # When fetching a Node, the api returns a 'Not Found' (404) error197 # When fetching a Node, the api returns a 'Not Found' (404) error
189 # if no node is found.198 # if no node is found.
@@ -930,6 +939,20 @@
930 node = reload_object(node)939 node = reload_object(node)
931 self.assertEqual(original_setting, node.disable_ipv4)940 self.assertEqual(original_setting, node.disable_ipv4)
932941
942 def test_PUT_updates_boot_type(self):
943 node = factory.make_Node(
944 owner=self.logged_in_user,
945 architecture=make_usable_architecture(self),
946 boot_type=NODE_BOOT.FASTPATH,
947 )
948 response = self.client_put(
949 self.get_node_uri(node), {'boot_type': NODE_BOOT.DEBIAN})
950 parsed_result = json.loads(response.content)
951 self.assertEqual(httplib.OK, response.status_code, response.content)
952 node = reload_object(node)
953 self.assertEqual(node.boot_type, parsed_result['boot_type'])
954 self.assertEqual(node.boot_type, NODE_BOOT.DEBIAN)
955
933 def test_DELETE_deletes_node(self):956 def test_DELETE_deletes_node(self):
934 # The api allows to delete a Node.957 # The api allows to delete a Node.
935 self.become_admin()958 self.become_admin()
936959
=== modified file 'src/maasserver/forms.py'
--- src/maasserver/forms.py 2014-12-15 09:59:57 +0000
+++ src/maasserver/forms.py 2015-05-26 16:37:00 +0000
@@ -86,6 +86,8 @@
86from maasserver.enum import (86from maasserver.enum import (
87 BOOT_RESOURCE_FILE_TYPE,87 BOOT_RESOURCE_FILE_TYPE,
88 BOOT_RESOURCE_TYPE,88 BOOT_RESOURCE_TYPE,
89 NODE_BOOT,
90 NODE_BOOT_CHOICES,
89 NODE_STATUS,91 NODE_STATUS,
90 NODEGROUPINTERFACE_MANAGEMENT,92 NODEGROUPINTERFACE_MANAGEMENT,
91 NODEGROUPINTERFACE_MANAGEMENT_CHOICES,93 NODEGROUPINTERFACE_MANAGEMENT_CHOICES,
@@ -481,6 +483,13 @@
481 self.cleaned_data['disable_ipv4'] = False483 self.cleaned_data['disable_ipv4'] = False
482 return self.cleaned_data['disable_ipv4']484 return self.cleaned_data['disable_ipv4']
483485
486 def clean_boot_type(self):
487 boot_type = self.cleaned_data.get('boot_type')
488 if not boot_type:
489 return NODE_BOOT.FASTPATH
490 else:
491 return boot_type
492
484 def clean(self):493 def clean(self):
485 cleaned_data = super(NodeForm, self).clean()494 cleaned_data = super(NodeForm, self).clean()
486 if self.new_node and self.data.get('disable_ipv4') is None:495 if self.new_node and self.data.get('disable_ipv4') is None:
@@ -578,6 +587,9 @@
578 "does not manage DNS, then the host name as entered will be the "587 "does not manage DNS, then the host name as entered will be the "
579 "FQDN."))588 "FQDN."))
580589
590 boot_type = forms.ChoiceField(
591 choices=NODE_BOOT_CHOICES, initial=NODE_BOOT.FASTPATH, required=False)
592
581 class Meta:593 class Meta:
582 model = Node594 model = Node
583595
@@ -590,6 +602,7 @@
590 'distro_series',602 'distro_series',
591 'license_key',603 'license_key',
592 'disable_ipv4',604 'disable_ipv4',
605 'boot_type',
593 )606 )
594607
595608
596609
=== modified file 'src/maasserver/testing/factory.py'
--- src/maasserver/testing/factory.py 2014-12-04 12:33:26 +0000
+++ src/maasserver/testing/factory.py 2015-05-26 16:37:00 +0000
@@ -30,6 +30,7 @@
30 BOOT_RESOURCE_FILE_TYPE,30 BOOT_RESOURCE_FILE_TYPE,
31 BOOT_RESOURCE_TYPE,31 BOOT_RESOURCE_TYPE,
32 IPADDRESS_TYPE,32 IPADDRESS_TYPE,
33 NODE_BOOT,
33 NODE_STATUS,34 NODE_STATUS,
34 NODEGROUP_STATUS,35 NODEGROUP_STATUS,
35 NODEGROUPINTERFACE_MANAGEMENT,36 NODEGROUPINTERFACE_MANAGEMENT,
@@ -213,8 +214,9 @@
213 def make_Node(self, mac=False, hostname=None, status=None,214 def make_Node(self, mac=False, hostname=None, status=None,
214 architecture="i386/generic", updated=None,215 architecture="i386/generic", updated=None,
215 created=None, nodegroup=None, routers=None, zone=None,216 created=None, nodegroup=None, routers=None, zone=None,
216 power_type=None, networks=None, sortable_name=False,217 power_type=None, networks=None, boot_type=None,
217 power_state=None, disable_ipv4=None, **kwargs):218 sortable_name=False, power_state=None, disable_ipv4=None,
219 **kwargs):
218 """Make a :class:`Node`.220 """Make a :class:`Node`.
219221
220 :param sortable_name: If `True`, use a that will sort consistently222 :param sortable_name: If `True`, use a that will sort consistently
@@ -242,11 +244,13 @@
242 power_state = self.pick_enum(POWER_STATE)244 power_state = self.pick_enum(POWER_STATE)
243 if disable_ipv4 is None:245 if disable_ipv4 is None:
244 disable_ipv4 = self.pick_bool()246 disable_ipv4 = self.pick_bool()
247 if boot_type is None:
248 boot_type = self.pick_enum(NODE_BOOT)
245 node = Node(249 node = Node(
246 hostname=hostname, status=status, architecture=architecture,250 hostname=hostname, status=status, architecture=architecture,
247 nodegroup=nodegroup, routers=routers, zone=zone,251 nodegroup=nodegroup, routers=routers, zone=zone,
248 power_type=power_type, disable_ipv4=disable_ipv4,252 power_type=power_type, disable_ipv4=disable_ipv4,
249 power_state=power_state,253 power_state=power_state, boot_type=boot_type,
250 **kwargs)254 **kwargs)
251 self._save_node_unchecked(node)255 self._save_node_unchecked(node)
252 # We do not generate random networks by default because the limited256 # We do not generate random networks by default because the limited
253257
=== modified file 'src/maasserver/tests/test_forms_node.py'
--- src/maasserver/tests/test_forms_node.py 2014-10-19 20:08:50 +0000
+++ src/maasserver/tests/test_forms_node.py 2015-05-26 16:37:00 +0000
@@ -69,6 +69,7 @@
69 'distro_series',69 'distro_series',
70 'license_key',70 'license_key',
71 'disable_ipv4',71 'disable_ipv4',
72 'boot_type',
72 'nodegroup'73 'nodegroup'
73 ], list(form.fields))74 ], list(form.fields))
7475
@@ -492,6 +493,7 @@
492 'distro_series',493 'distro_series',
493 'license_key',494 'license_key',
494 'disable_ipv4',495 'disable_ipv4',
496 'boot_type',
495 'power_type',497 'power_type',
496 'power_parameters',498 'power_parameters',
497 'cpu_count',499 'cpu_count',

Subscribers

People subscribed via source and target branches

to all changes: