← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~jtv/maas/bug-979397 into lp:maas

 

Jeroen T. Vermeulen has proposed merging lp:~jtv/maas/bug-979397 into lp:maas.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #979397 in MAAS: "Options to remove from Settings page for 12.04 final freeze"
  https://bugs.launchpad.net/maas/+bug/979397

For more details, see:
https://code.launchpad.net/~jtv/maas/bug-979397/+merge/101680

As per the bug, and chat with Julian: in the current state of implementation, after_commissioning_status is not a meaningful choice (only one of the 3 options is valid) so we're hiding it from the UI for now.  On the settings form, the Commissioning and Ubuntu sections are hidden entirely.

I filed bug 979539 for undoing this again later.  I believe I highlighted all places that need attention with a comment referencing that number.

Note that I leave the after-commissioning-action field in the CommissioningForm; the form is no longer included in the page at all so it shouldn't need commenting out.


Jeroen
-- 
https://code.launchpad.net/~jtv/maas/bug-979397/+merge/101680
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jtv/maas/bug-979397 into lp:maas.
=== modified file 'src/maasserver/forms.py'
--- src/maasserver/forms.py	2012-04-10 08:20:43 +0000
+++ src/maasserver/forms.py	2012-04-12 04:27:22 +0000
@@ -50,7 +50,6 @@
     Config,
     MACAddress,
     Node,
-    NODE_AFTER_COMMISSIONING_ACTION,
     NODE_AFTER_COMMISSIONING_ACTION_CHOICES,
     NODE_PERMISSION,
     NODE_STATUS,
@@ -83,10 +82,14 @@
     system_id = forms.CharField(
         widget=forms.TextInput(attrs={'readonly': 'readonly'}),
         required=False)
-    after_commissioning_action = forms.TypedChoiceField(
-        label="After commissioning",
-        choices=NODE_AFTER_COMMISSIONING_ACTION_CHOICES, required=False,
-        empty_value=NODE_AFTER_COMMISSIONING_ACTION.DEFAULT)
+
+    # XXX JeroenVermeulen 2012-04-12, bug=979539: re-enable.
+
+    #after_commissioning_action = forms.TypedChoiceField(
+    #    label="After commissioning",
+    #    choices=NODE_AFTER_COMMISSIONING_ACTION_CHOICES, required=False,
+    #    empty_value=NODE_AFTER_COMMISSIONING_ACTION.DEFAULT)
+
     architecture = forms.ChoiceField(
         choices=ARCHITECTURE_CHOICES, required=True,
         initial=ARCHITECTURE.i386,
@@ -95,29 +98,48 @@
     class Meta:
         model = Node
         fields = (
-            'hostname', 'system_id', 'after_commissioning_action',
-            'architecture', 'power_type')
+            'hostname',
+            'system_id',
+            # XXX JeroenVermeulen 2012-04-12, bug=979539: re-enable.
+            #'after_commissioning_action',
+            'architecture',
+            'power_type',
+            )
 
 
 class UINodeEditForm(ModelForm):
-    after_commissioning_action = forms.ChoiceField(
-        label="After commissioning",
-        choices=NODE_AFTER_COMMISSIONING_ACTION_CHOICES)
+
+    # XXX JeroenVermeulen 2012-04-12, bug=979539: re-enable.
+
+    #after_commissioning_action = forms.ChoiceField(
+    #    label="After commissioning",
+    #    choices=NODE_AFTER_COMMISSIONING_ACTION_CHOICES)
 
     class Meta:
         model = Node
-        fields = ('hostname', 'after_commissioning_action')
+        fields = (
+            'hostname',
+            # XXX JeroenVermeulen 2012-04-12, bug=979539: re-enable.
+            #'after_commissioning_action',
+            )
 
 
 class UIAdminNodeEditForm(ModelForm):
-    after_commissioning_action = forms.ChoiceField(
-        label="After commissioning",
-        choices=NODE_AFTER_COMMISSIONING_ACTION_CHOICES)
+
+    # XXX JeroenVermeulen 2012-04-12, bug=979539: re-enable.
+
+    #after_commissioning_action = forms.ChoiceField(
+    #    label="After commissioning",
+    #    choices=NODE_AFTER_COMMISSIONING_ACTION_CHOICES)
 
     class Meta:
         model = Node
         fields = (
-            'hostname', 'after_commissioning_action', 'power_type')
+            'hostname',
+            # XXX JeroenVermeulen 2012-04-12, bug=979539: re-enable.
+            #'after_commissioning_action',
+            'power_type',
+            )
 
 
 class MACAddressForm(ModelForm):

=== modified file 'src/maasserver/templates/maasserver/settings.html'
--- src/maasserver/templates/maasserver/settings.html	2012-03-22 06:38:06 +0000
+++ src/maasserver/templates/maasserver/settings.html	2012-04-12 04:27:22 +0000
@@ -67,7 +67,8 @@
       </a>
       <div class="clear"></div>
     </div>
-    <div id="commissioning" class="block size7 first">
+<!-- XXX JeroenVermeulen 2012-04-12, bug=979539: re-enable. -->
+    <div id="commissioning" class="hidden block size7 first">
       <h2>Commissioning</h2>
       <form action="{% url "settings" %}" method="post">
         <ul>
@@ -79,7 +80,8 @@
         <input type="submit" class="button right" value="Save" />
       </form>
     </div>
-    <div id="ubuntu" class="block size7 first">
+<!-- XXX JeroenVermeulen 2012-04-12, bug=979539: re-enable. -->
+    <div id="ubuntu" class="hidden block size7 first">
       <h2>Ubuntu</h2>
       <form action="{% url "settings" %}" method="post">
         <ul>

=== modified file 'src/maasserver/templates/maasserver/snippets.html'
--- src/maasserver/templates/maasserver/snippets.html	2012-04-09 04:52:52 +0000
+++ src/maasserver/templates/maasserver/snippets.html	2012-04-12 04:27:22 +0000
@@ -21,7 +21,8 @@
     <div class="field-help">Default is MAC-based, e.g. "node-aabbccddeeff"
     </div>
   </p>
-  <p>
+<!-- XXX JeroenVermeulen 2012-04-12, bug=979539: re-enable. -->
+  <p class="hidden">
     <label for="id_after_commissioning_action">After commissioning</label>
     {{ node_form.after_commissioning_action }}
   </p>

=== modified file 'src/maasserver/tests/test_api.py'
--- src/maasserver/tests/test_api.py	2012-04-10 13:44:16 +0000
+++ src/maasserver/tests/test_api.py	2012-04-12 04:27:22 +0000
@@ -120,7 +120,8 @@
         self.assertEqual('diane', parsed_result['hostname'])
         self.assertNotEqual(0, len(parsed_result.get('system_id')))
         [diane] = Node.objects.filter(hostname='diane')
-        self.assertEqual(2, diane.after_commissioning_action)
+        # XXX JeroenVermeulen 2012-04-12, bug=979539: re-enable.
+        #self.assertEqual(2, diane.after_commissioning_action)
         self.assertEqual(architecture, diane.architecture)
 
     def test_POST_new_power_type_defaults_to_asking_config(self):

=== modified file 'src/maasserver/tests/test_forms.py'
--- src/maasserver/tests/test_forms.py	2012-04-05 07:34:05 +0000
+++ src/maasserver/tests/test_forms.py	2012-04-12 04:27:22 +0000
@@ -184,7 +184,10 @@
         form = UINodeEditForm()
 
         self.assertEqual(
-            ['hostname', 'after_commissioning_action'], list(form.fields))
+            [
+                'hostname',
+                #'after_commissioning_action',
+            ], list(form.fields))
 
     def test_UINodeEditForm_changes_node(self):
         node = factory.make_node()
@@ -201,14 +204,20 @@
         form.save()
 
         self.assertEqual(hostname, node.hostname)
-        self.assertEqual(
-            after_commissioning_action, node.after_commissioning_action)
+        # XXX JeroenVermeulen 2012-04-12, bug=979539: re-enable.
+        #self.assertEqual(
+        #    after_commissioning_action, node.after_commissioning_action)
 
     def test_UIAdminNodeEditForm_contains_limited_set_of_fields(self):
         form = UIAdminNodeEditForm()
 
-        self.assertSequenceEqual(
-            ['hostname', 'after_commissioning_action', 'power_type'],
+        self.assertEqual(
+            [
+                'hostname',
+                # XXX JeroenVermeulen 2012-04-12, bug=979539: re-enable.
+                #'after_commissioning_action',
+                'power_type',
+            ],
             list(form.fields))
 
     def test_UIAdminNodeEditForm_changes_node(self):
@@ -227,8 +236,9 @@
         form.save()
 
         self.assertEqual(hostname, node.hostname)
-        self.assertEqual(
-            after_commissioning_action, node.after_commissioning_action)
+        # XXX JeroenVermeulen 2012-04-12, bug=979539: re-enable.
+        #self.assertEqual(
+        #    after_commissioning_action, node.after_commissioning_action)
         self.assertEqual(power_type, node.power_type)
 
 

=== modified file 'src/maasserver/tests/test_views.py'
--- src/maasserver/tests/test_views.py	2012-04-12 02:20:42 +0000
+++ src/maasserver/tests/test_views.py	2012-04-12 04:27:22 +0000
@@ -158,7 +158,8 @@
         self.assertTemplateExistsAndContains(
             response.content, '#add-node', 'input#id_hostname')
 
-    def test_after_commissioning_action_snippet(self):
+    # XXX JeroenVermeulen 2012-04-12, bug=979539: re-enable.
+    def t_e_s_t_after_commissioning_action_snippet(self):
         response = self.client.get('/')
         self.assertTemplateExistsAndContains(
             response.content, '#add-node',
@@ -650,8 +651,9 @@
         node_edit_link = reverse('node-edit', args=[node.system_id])
         params = {
             'hostname': factory.getRandomString(),
-            'after_commissioning_action': factory.getRandomEnum(
-                NODE_AFTER_COMMISSIONING_ACTION),
+            # XXX JeroenVermeulen 2012-04-12, bug=979539: re-enable.
+            #'after_commissioning_action': factory.getRandomEnum(
+            #    NODE_AFTER_COMMISSIONING_ACTION),
         }
         response = self.client.post(node_edit_link, params)
 
@@ -780,8 +782,9 @@
         node_edit_link = reverse('node-edit', args=[node.system_id])
         params = {
             'hostname': factory.getRandomString(),
-            'after_commissioning_action': factory.getRandomEnum(
-                NODE_AFTER_COMMISSIONING_ACTION),
+            # XXX JeroenVermeulen 2012-04-12, bug=979539: re-enable.
+            #'after_commissioning_action': factory.getRandomEnum(
+            #    NODE_AFTER_COMMISSIONING_ACTION),
             'power_type': factory.getRandomChoice(POWER_TYPE_CHOICES),
         }
         response = self.client.post(node_edit_link, params)