launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #12161
[Merge] lp:~andreserl/maas/add_api_parameter_for_ubuntu_series into lp:maas
Andres Rodriguez has proposed merging lp:~andreserl/maas/add_api_parameter_for_ubuntu_series into lp:maas with lp:~andreserl/maas/distro_series_support as a prerequisite.
Requested reviews:
MAAS Maintainers (maas-maintainers)
For more details, see:
https://code.launchpad.net/~andreserl/maas/add_api_parameter_for_ubuntu_series/+merge/125016
--
https://code.launchpad.net/~andreserl/maas/add_api_parameter_for_ubuntu_series/+merge/125016
Your team MAAS Maintainers is requested to review the proposed merge of lp:~andreserl/maas/add_api_parameter_for_ubuntu_series into lp:maas.
=== modified file 'src/maasserver/api.py'
--- src/maasserver/api.py 2012-09-18 18:29:20 +0000
+++ src/maasserver/api.py 2012-09-18 18:29:20 +0000
@@ -518,14 +518,23 @@
The user_data parameter, if set in the POST data, is taken as
base64-encoded binary data.
+ The ubuntu_series parameter, if set in the POST data, is taken as
+ clear text. This parameter specifies the Ubuntu Release the node
+ will use.
+
Ideally we'd have MIME multipart and content-transfer-encoding etc.
deal with the encapsulation of binary data, but couldn't make it work
with the framework in reasonable time so went for a dumb, manual
encoding instead.
"""
user_data = request.POST.get('user_data', None)
+ series = request.POST.get('ubuntu_series', None)
if user_data is not None:
user_data = b64decode(user_data)
+ if series is not None:
+ node = Node.objects.get_node_or_404(
+ system_id=system_id, user=request.user, perm=NODE_PERMISSION.EDIT)
+ node.set_distro_series(series=series)
nodes = Node.objects.start_nodes(
[system_id], request.user, user_data=user_data)
if len(nodes) == 0:
@@ -538,6 +547,7 @@
"""Release a node. Opposite of `NodesHandler.acquire`."""
node = Node.objects.get_node_or_404(
system_id=system_id, user=request.user, perm=NODE_PERMISSION.EDIT)
+ node.set_distro_series(series='')
if node.status == NODE_STATUS.READY:
# Nothing to do. This may be a redundant retry, and the
# postcondition is achieved, so call this success.
=== modified file 'src/maasserver/models/node.py'
--- src/maasserver/models/node.py 2012-09-18 18:29:20 +0000
+++ src/maasserver/models/node.py 2012-09-18 18:29:20 +0000
@@ -567,6 +567,11 @@
else:
return self.distro_series
+ def set_distro_series(self, series=''):
+ """Set the distro series to install that node."""
+ self.distro_series = series
+ self.save()
+
def get_effective_power_parameters(self):
"""Return effective power parameters, including any defaults."""
if self.power_parameters:
Follow ups