← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~andreserl/maas/default_traditional_installer into lp:maas

 

Andres Rodriguez has proposed merging lp:~andreserl/maas/default_traditional_installer into lp:maas.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~andreserl/maas/default_traditional_installer/+merge/162241
-- 
https://code.launchpad.net/~andreserl/maas/default_traditional_installer/+merge/162241
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~andreserl/maas/default_traditional_installer into lp:maas.
=== modified file 'src/maasserver/models/node.py'
--- src/maasserver/models/node.py	2013-04-24 14:43:51 +0000
+++ src/maasserver/models/node.py	2013-05-02 20:47:25 +0000
@@ -818,23 +818,23 @@
     def should_use_traditional_installer(self):
         """Should this node be installed with the traditional installer?
 
-        By default, nodes should be installed with the default installer, so
-        this returns `False`.
-        """
-        return self.tags.filter(name="use-traditional-installer").exists()
-
-    def should_use_default_installer(self):
-        """Should this node be installed with the default installer?
-
-        By default, nodes should be installed with the default installer, the
-        Fast Path installer, so this returns `True`.
-        """
-        return not self.should_use_traditional_installer()
+        By default, nodes should be installed with the traditional installer,
+        so this returns `True`.
+        """
+        return not self.should_use_fastpath_installer()
+
+    def should_use_fastpath_installer(self):
+        """Should this node be installed with the Fast Path installer?
+
+        By default, nodes should be installed with the traditional installer,
+         so this returns `False`.
+        """
+        return self.tags.filter(name="use-fastpath-installer").exists()
 
     def use_traditional_installer(self):
         """Set this node to be installed with the traditional installer.
 
-        By default, nodes should be installed with the Fast Path installer.
+        By default, nodes should be installed with the Traditional installer.
 
         :raises: :class:`RuntimeError` when the `use-traditional-installer`
             tag is defined *with* an expression. The reason is that the tag
@@ -842,29 +842,29 @@
             make with this method.
         """
         uti_tag, _ = Tag.objects.get_or_create(
-            name="use-traditional-installer")
-        if uti_tag.definition != "":
-            raise RuntimeError(
-                "The use-traditional-installer tag is defined with an "
-                "expression. This expression much be updated to make this "
-                "node boot with the traditional installer.")
+            name="use-fastpath-installer")
+        if uti_tag.definition != "":
+            raise RuntimeError(
+                "The use-fastpath-installer tag is defined with an "
+                "expression. This expression must be updated to prevent "
+                "this node from booting with the Fast Path installer.")
+        self.tags.remove(uti_tag)
+
+    def use_fastpath_installer(self):
+        """Set this node to be installed with the Fast Path Installer.
+
+        By default, nodes should be installed with the Traditional Installer.
+
+        :raises: :class:`RuntimeError` when the `use-fastpath-installer`
+            tag is defined *with* an expression. The reason is that the tag
+            evaluation machinery will eventually ignore whatever changes you
+            make with this method.
+        """
+        uti_tag, _ = Tag.objects.get_or_create(
+            name="use-fastpath-installer")
+        if uti_tag.definition != "":
+            raise RuntimeError(
+                "The use-fastpath-installer tag is defined with an "
+                "expression. This expression must be updated to make this "
+                "node boot with the Fast Path Installer.")
         self.tags.add(uti_tag)
-
-    def use_default_installer(self):
-        """Set this node to be installed with the default installer.
-
-        By default, nodes should be installed with the Fast Path installer.
-
-        :raises: :class:`RuntimeError` when the `use-traditional-installer`
-            tag is defined *with* an expression. The reason is that the tag
-            evaluation machinery will eventually ignore whatever changes you
-            make with this method.
-        """
-        uti_tag, _ = Tag.objects.get_or_create(
-            name="use-traditional-installer")
-        if uti_tag.definition != "":
-            raise RuntimeError(
-                "The use-traditional-installer tag is defined with an "
-                "expression. This expression much be updated to prevent "
-                "this node from booting with the traditional installer.")
-        self.tags.remove(uti_tag)

=== modified file 'src/maasserver/tests/test_node.py'
--- src/maasserver/tests/test_node.py	2013-04-24 14:43:51 +0000
+++ src/maasserver/tests/test_node.py	2013-05-02 20:47:25 +0000
@@ -678,87 +678,87 @@
         expected_hostname = '%s.%s' % (hostname_without_domain, domain)
         self.assertEqual(expected_hostname, node.fqdn)
 
-    def test_should_use_default_installer_by_default(self):
-        node = factory.make_node()
-        self.assertTrue(node.should_use_default_installer())
-
-    def test_should_use_traditional_installer_not_by_default(self):
-        node = factory.make_node()
+    def test_should_use_traditional_installer_by_default(self):
+        node = factory.make_node()
+        self.assertTrue(node.should_use_traditional_installer())
+
+    def test_should_use_fastpath_installer_not_by_default(self):
+        node = factory.make_node()
+        self.assertFalse(node.should_use_fastpath_installer())
+
+    def test_should_use_traditional_installer_not_when_tag_applies(self):
+        node = factory.make_node()
+        tag = factory.make_tag(name="use-fastpath-installer")
+        tag.save()
+        node.tags.add(tag)
         self.assertFalse(node.should_use_traditional_installer())
 
-    def test_should_use_default_installer_not_when_tag_applies(self):
-        node = factory.make_node()
-        tag = factory.make_tag(name="use-traditional-installer")
-        tag.save()
-        node.tags.add(tag)
-        self.assertFalse(node.should_use_default_installer())
-
-    def test_should_use_traditional_installer_when_tag_applies(self):
-        node = factory.make_node()
-        tag = factory.make_tag(name="use-traditional-installer")
-        tag.save()
-        node.tags.add(tag)
-        self.assertTrue(node.should_use_traditional_installer())
+    def test_should_use_fastpath_installer_when_tag_applies(self):
+        node = factory.make_node()
+        tag = factory.make_tag(name="use-fastpath-installer")
+        tag.save()
+        node.tags.add(tag)
+        self.assertTrue(node.should_use_fastpath_installer())
 
     def test_use_xxx_installer(self):
-        # use_default_installer() and use_traditional_installer() can be used
+        # use_fastpath_installer() and use_traditional_installer() can be used
         # to affect what the should_use_xxx_installer() methods return.
         node = factory.make_node()
         node.use_traditional_installer()
-        self.assertFalse(node.should_use_default_installer())
+        self.assertFalse(node.should_use_fastpath_installer())
         self.assertTrue(node.should_use_traditional_installer())
-        node.use_default_installer()
-        self.assertTrue(node.should_use_default_installer())
+        node.use_fastpath_installer()
+        self.assertTrue(node.should_use_fastpath_installer())
         self.assertFalse(node.should_use_traditional_installer())
 
-    def test_use_default_installer_dissociates_tag_from_node(self):
-        # use_default_installer removes any association with the
-        # use-traditional-installer tag. The tag is created even if it did not
+    def test_use_traditional_installer_dissociates_tag_from_node(self):
+        # use_traditional_installer removes any association with the
+        # use-fastpath-installer tag. The tag is created even if it did not
         # previously exist. If it does already exist, it is not deleted.
         find_tag = lambda: list(
-            Tag.objects.filter(name="use-traditional-installer"))
+            Tag.objects.filter(name="use-fastpath-installer"))
         node = factory.make_node()
-        node.use_default_installer()
+        node.use_traditional_installer()
         self.assertNotEqual([], find_tag())
+        node.use_fastpath_installer()
         node.use_traditional_installer()
-        node.use_default_installer()
         self.assertNotEqual([], find_tag())
 
-    def test_use_traditional_installer_associates_tag_with_node(self):
+    def test_use_fastpath_installer_associates_tag_with_node(self):
         # use_traditional_installer() creates the use-traditional-installer
         # tag when it is first needed, and associates it with the node.
         find_tag = lambda: list(
-            Tag.objects.filter(name="use-traditional-installer"))
+            Tag.objects.filter(name="use-fastpath-installer"))
         self.assertEqual([], find_tag())
         node = factory.make_node()
-        node.use_traditional_installer()
+        node.use_fastpath_installer()
         self.assertNotEqual([], find_tag())
 
-    def test_use_default_installer_complains_when_tag_has_expression(self):
-        # use_default_installer() complains when the use-traditional-installer
+    def test_use_traditional_installer_complains_when_tag_has_expression(self):
+        # use_traditional_installer() complains when the use-fastpath-installer
         # tag exists and is defined with an expression.
         node = factory.make_node()
         factory.make_tag(
-            name="use-traditional-installer",
+            name="use-fastpath-installer",
             definition="//something")
         error = self.assertRaises(
-            RuntimeError, node.use_default_installer)
+            RuntimeError, node.use_traditional_installer)
         self.assertIn(
-            "The use-traditional-installer tag is defined with an expression",
+            "The use-fastpath-installer tag is defined with an expression",
             unicode(error))
 
-    def test_use_traditional_installer_complains_when_tag_has_expression(self):
-        # use_traditional_installer() complains when the
-        # use-traditional-installer tag exists and is defined with an
+    def test_use_fastpath_installer_complains_when_tag_has_expression(self):
+        # use_fastpath_installer() complains when the
+        # use-fastpath-installer tag exists and is defined with an
         # expression.
         node = factory.make_node()
         factory.make_tag(
-            name="use-traditional-installer",
+            name="use-fastpath-installer",
             definition="//something")
         error = self.assertRaises(
-            RuntimeError, node.use_traditional_installer)
+            RuntimeError, node.use_fastpath_installer)
         self.assertIn(
-            "The use-traditional-installer tag is defined with an expression",
+            "The use-fastpath-installer tag is defined with an expression",
             unicode(error))
 
 


Follow ups