Unclear how to get the effective distro series for a node

Bug #1054515 reported by Gavin Panella
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Won't Fix
Medium
Unassigned

Bug Description

[lp:~andreserl/maas/distro_series_support was merged moments before my
review landed; this bug documents one of the points that still needs
addressing.]

In src/maasserver/api.py:

+    if node is None or node.status == NODE_STATUS.COMMISSIONING:
+        series = Config.objects.get_config('commissioning_distro_series')
+    else:
+        series = node.get_distro_series()

In src/maasserver/models/node.py:

+    def get_distro_series(self):
+        """Return the distro series to install that node."""
+        if not self.distro_series or self.distro_series == DISTRO_SERIES.default:
+            return Config.objects.get_config('default_distro_series')
+        else:
+            return self.distro_series

There's two levels of overriding here: get_distro_series() can return
something other than node.distro_series, and then the code in the API
view can return something else again.

I suggest putting the logic that's in the API view into
get_distro_series, and renaming the method:

    def get_effective_distro_series(self):
        """Return the distro series to install that node."""
        if node is None or node.status == NODE_STATUS.COMMISSIONING:
            return Config.objects.get_config('commissioning_distro_series')
        elif not self.distro_series or self.distro_series == DISTRO_SERIES.default:
            return Config.objects.get_config('default_distro_series')
        else:
            return self.distro_series

Changed in maas:
importance: High → Medium
Changed in maas:
status: Triaged → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.