launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #07196
[Merge] lp:~jtv/maas/bug-979539 into lp:maas
Jeroen T. Vermeulen has proposed merging lp:~jtv/maas/bug-979539 into lp:maas.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #979539 in MAAS: "Re-enable after-commissioning actions"
https://bugs.launchpad.net/maas/+bug/979539
For more details, see:
https://code.launchpad.net/~jtv/maas/bug-979539/+merge/103047
As discussed with Julian. This re-enables the after-commissioning actions choices in the UI.
There are two “but”s:
1. As agreed, this disables the two nonexistent options, leaving only one choice.
2. The new add-node form lacks an entry for this choice. Filed separately as bug 987092.
Jeroen
--
https://code.launchpad.net/~jtv/maas/bug-979539/+merge/103047
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jtv/maas/bug-979539 into lp:maas.
=== modified file 'src/maasserver/enum.py'
--- src/maasserver/enum.py 2012-04-20 15:16:41 +0000
+++ src/maasserver/enum.py 2012-04-23 06:23:19 +0000
@@ -19,9 +19,7 @@
'NODE_STATUS_CHOICES_DICT',
]
-from collections import (
- OrderedDict,
- )
+from collections import OrderedDict
class NODE_STATUS:
@@ -77,18 +75,18 @@
#:
QUEUE = 0
#:
- CHECK = 1
+ #CHECK = 1
#:
- DEPLOY_12_04 = 2
+ #DEPLOY_12_04 = 2
NODE_AFTER_COMMISSIONING_ACTION_CHOICES = (
(NODE_AFTER_COMMISSIONING_ACTION.QUEUE,
"Queue for dynamic allocation to services"),
- (NODE_AFTER_COMMISSIONING_ACTION.CHECK,
- "Check compatibility and hold for future decision"),
- (NODE_AFTER_COMMISSIONING_ACTION.DEPLOY_12_04,
- "Deploy with Ubuntu 12.04 LTS"),
+ #(NODE_AFTER_COMMISSIONING_ACTION.CHECK,
+ # "Check compatibility and hold for future decision"),
+ #(NODE_AFTER_COMMISSIONING_ACTION.DEPLOY_12_04,
+ # "Deploy with Ubuntu 12.04 LTS"),
)
=== modified file 'src/maasserver/forms.py'
--- src/maasserver/forms.py 2012-04-20 15:16:41 +0000
+++ src/maasserver/forms.py 2012-04-23 06:23:19 +0000
@@ -47,6 +47,7 @@
from maasserver.enum import (
ARCHITECTURE,
ARCHITECTURE_CHOICES,
+ NODE_AFTER_COMMISSIONING_ACTION,
NODE_AFTER_COMMISSIONING_ACTION_CHOICES,
NODE_PERMISSION,
NODE_STATUS,
@@ -86,12 +87,10 @@
widget=forms.TextInput(attrs={'readonly': 'readonly'}),
required=False)
- # 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)
+ 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,
@@ -103,8 +102,7 @@
fields = (
'hostname',
'system_id',
- # XXX JeroenVermeulen 2012-04-12, bug=979539: re-enable.
- #'after_commissioning_action',
+ 'after_commissioning_action',
'architecture',
'power_type',
)
@@ -112,35 +110,29 @@
class UINodeEditForm(ModelForm):
- # XXX JeroenVermeulen 2012-04-12, bug=979539: re-enable.
-
- #after_commissioning_action = forms.ChoiceField(
- # label="After commissioning",
- # choices=NODE_AFTER_COMMISSIONING_ACTION_CHOICES)
+ after_commissioning_action = forms.ChoiceField(
+ label="After commissioning",
+ choices=NODE_AFTER_COMMISSIONING_ACTION_CHOICES)
class Meta:
model = Node
fields = (
'hostname',
- # XXX JeroenVermeulen 2012-04-12, bug=979539: re-enable.
- #'after_commissioning_action',
+ 'after_commissioning_action',
)
class UIAdminNodeEditForm(ModelForm):
- # XXX JeroenVermeulen 2012-04-12, bug=979539: re-enable.
-
- #after_commissioning_action = forms.ChoiceField(
- # label="After commissioning",
- # choices=NODE_AFTER_COMMISSIONING_ACTION_CHOICES)
+ after_commissioning_action = forms.ChoiceField(
+ label="After commissioning",
+ choices=NODE_AFTER_COMMISSIONING_ACTION_CHOICES)
class Meta:
model = Node
fields = (
'hostname',
- # XXX JeroenVermeulen 2012-04-12, bug=979539: re-enable.
- #'after_commissioning_action',
+ 'after_commissioning_action',
'power_type',
)
=== modified file 'src/maasserver/static/js/node_add.js'
--- src/maasserver/static/js/node_add.js 2012-04-17 15:48:27 +0000
+++ src/maasserver/static/js/node_add.js 2012-04-23 06:23:19 +0000
@@ -106,6 +106,8 @@
}
},
+ // XXX JeroenVermeulen 2012-04-23, bug=987092: Restore the
+ // after-commissioning dropdown.
createForm: function() {
var addnode_button = Y.Node.create('<button />')
.addClass('add-node-button')
=== modified file 'src/maasserver/templates/maasserver/settings.html'
--- src/maasserver/templates/maasserver/settings.html 2012-04-16 05:48:10 +0000
+++ src/maasserver/templates/maasserver/settings.html 2012-04-23 06:23:19 +0000
@@ -68,8 +68,7 @@
</a>
<div class="clear"></div>
</div>
-<!-- XXX JeroenVermeulen 2012-04-12, bug=979539: re-enable. -->
- <div id="commissioning" class="hidden block size7 first">
+ <div id="commissioning" class="block size7 first">
<h2>Commissioning</h2>
<form action="{% url "settings" %}" method="post">
<ul>
@@ -81,8 +80,7 @@
<input type="submit" class="button right" value="Save" />
</form>
</div>
-<!-- XXX JeroenVermeulen 2012-04-12, bug=979539: re-enable. -->
- <div id="ubuntu" class="hidden block size7 first">
+ <div id="ubuntu" class="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-12 04:21:18 +0000
+++ src/maasserver/templates/maasserver/snippets.html 2012-04-23 06:23:19 +0000
@@ -21,9 +21,5 @@
<div class="field-help">Default is MAC-based, e.g. "node-aabbccddeeff"
</div>
</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>
+ <p>
</script>
=== modified file 'src/maasserver/tests/test_api.py'
--- src/maasserver/tests/test_api.py 2012-04-20 15:16:41 +0000
+++ src/maasserver/tests/test_api.py 2012-04-23 06:23:19 +0000
@@ -30,6 +30,7 @@
)
from maasserver.enum import (
ARCHITECTURE_CHOICES,
+ NODE_AFTER_COMMISSIONING_ACTION,
NODE_STATUS,
NODE_STATUS_CHOICES_DICT,
)
@@ -113,7 +114,8 @@
'op': 'new',
'hostname': 'diane',
'architecture': architecture,
- 'after_commissioning_action': '2',
+ 'after_commissioning_action':
+ NODE_AFTER_COMMISSIONING_ACTION.DEFAULT,
'mac_addresses': ['aa:bb:cc:dd:ee:ff', '22:bb:cc:dd:ee:ff'],
})
parsed_result = json.loads(response.content)
@@ -123,8 +125,6 @@
self.assertEqual('diane', parsed_result['hostname'])
self.assertNotEqual(0, len(parsed_result.get('system_id')))
[diane] = Node.objects.filter(hostname='diane')
- # 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):
@@ -162,7 +162,8 @@
'op': 'new',
'hostname': 'diane',
'architecture': architecture,
- 'after_commissioning_action': '2',
+ 'after_commissioning_action':
+ NODE_AFTER_COMMISSIONING_ACTION.DEFAULT,
'mac_addresses': ['aa:bb:cc:dd:ee:ff', '22:bb:cc:dd:ee:ff'],
})
[diane] = Node.objects.filter(hostname='diane')
@@ -303,7 +304,8 @@
'op': 'new',
'hostname': factory.getRandomString(),
'architecture': factory.getRandomChoice(ARCHITECTURE_CHOICES),
- 'after_commissioning_action': '2',
+ 'after_commissioning_action':
+ NODE_AFTER_COMMISSIONING_ACTION.DEFAULT,
'mac_addresses': ['aa:bb:cc:dd:ee:ff'],
})
self.assertEqual(httplib.OK, response.status_code)
@@ -335,7 +337,8 @@
'op': 'new',
'architecture': factory.getRandomChoice(ARCHITECTURE_CHOICES),
'hostname': factory.getRandomString(),
- 'after_commissioning_action': '2',
+ 'after_commissioning_action':
+ NODE_AFTER_COMMISSIONING_ACTION.DEFAULT,
'mac_addresses': ['aa:bb:cc:dd:ee:ff', '22:bb:cc:dd:ee:ff'],
})
parsed_result = json.loads(response.content)
@@ -372,14 +375,19 @@
'op': 'new',
'hostname': factory.getRandomString(),
'architecture': factory.getRandomChoice(ARCHITECTURE_CHOICES),
- 'after_commissioning_action': '2',
+ 'after_commissioning_action':
+ NODE_AFTER_COMMISSIONING_ACTION.DEFAULT,
'mac_addresses': ['aa:bb:cc:dd:ee:ff', '22:bb:cc:dd:ee:ff'],
})
parsed_result = json.loads(response.content)
self.assertItemsEqual(
[
- 'hostname', 'system_id', 'macaddress_set', 'architecture',
- 'status', 'resource_uri',
+ 'hostname',
+ 'system_id',
+ 'macaddress_set',
+ 'architecture',
+ 'status',
+ 'resource_uri',
],
list(parsed_result))
@@ -398,7 +406,8 @@
'op': 'new',
'hostname': factory.getRandomString(),
'architecture': factory.getRandomChoice(ARCHITECTURE_CHOICES),
- 'after_commissioning_action': '2',
+ 'after_commissioning_action':
+ NODE_AFTER_COMMISSIONING_ACTION.DEFAULT,
'mac_addresses': ['aa:bb:cc:dd:ee:ff'],
})
self.assertEqual(httplib.OK, response.status_code)
@@ -414,7 +423,8 @@
'op': 'new',
'hostname': factory.getRandomString(),
'architecture': factory.getRandomChoice(ARCHITECTURE_CHOICES),
- 'after_commissioning_action': '2',
+ 'after_commissioning_action':
+ NODE_AFTER_COMMISSIONING_ACTION.DEFAULT,
'mac_addresses': ['aa:bb:cc:dd:ee:ff', '22:bb:cc:dd:ee:ff'],
})
parsed_result = json.loads(response.content)
@@ -843,7 +853,7 @@
"""Tests for /api/1.0/nodes/."""
def test_POST_new_creates_node(self):
- # The API allows a Node to be created, even as a logged-in user.
+ # The API allows a regular logged-in user to create a Node.
architecture = factory.getRandomChoice(ARCHITECTURE_CHOICES)
response = self.client.post(
self.get_uri('nodes/'),
@@ -851,7 +861,8 @@
'op': 'new',
'hostname': factory.getRandomString(),
'architecture': architecture,
- 'after_commissioning_action': '2',
+ 'after_commissioning_action':
+ NODE_AFTER_COMMISSIONING_ACTION.DEFAULT,
'mac_addresses': ['aa:bb:cc:dd:ee:ff', '22:bb:cc:dd:ee:ff'],
})
@@ -866,7 +877,8 @@
'op': 'new',
'hostname': factory.getRandomString(),
'architecture': factory.getRandomChoice(ARCHITECTURE_CHOICES),
- 'after_commissioning_action': '2',
+ 'after_commissioning_action':
+ NODE_AFTER_COMMISSIONING_ACTION.DEFAULT,
'mac_addresses': ['aa:bb:cc:dd:ee:ff'],
})
self.assertEqual(httplib.OK, response.status_code)
@@ -1734,7 +1746,8 @@
'op': 'new',
'hostname': hostname,
'architecture': architecture,
- 'after_commissioning_action': '2',
+ 'after_commissioning_action':
+ NODE_AFTER_COMMISSIONING_ACTION.DEFAULT,
'mac_addresses': ['aa:bb:cc:dd:ee:ff'],
})
=== modified file 'src/maasserver/tests/test_forms.py'
--- src/maasserver/tests/test_forms.py 2012-04-20 15:16:41 +0000
+++ src/maasserver/tests/test_forms.py 2012-04-23 06:23:19 +0000
@@ -189,8 +189,7 @@
self.assertEqual(
[
'hostname',
- # XXX JeroenVermeulen 2012-04-12, bug=979539: re-enable.
- #'after_commissioning_action',
+ 'after_commissioning_action',
], list(form.fields))
def test_UINodeEditForm_changes_node(self):
@@ -208,9 +207,8 @@
form.save()
self.assertEqual(hostname, node.hostname)
- # XXX JeroenVermeulen 2012-04-12, bug=979539: re-enable.
- #self.assertEqual(
- # after_commissioning_action, node.after_commissioning_action)
+ self.assertEqual(
+ after_commissioning_action, node.after_commissioning_action)
def test_UIAdminNodeEditForm_contains_limited_set_of_fields(self):
form = UIAdminNodeEditForm()
@@ -218,8 +216,7 @@
self.assertEqual(
[
'hostname',
- # XXX JeroenVermeulen 2012-04-12, bug=979539: re-enable.
- #'after_commissioning_action',
+ 'after_commissioning_action',
'power_type',
],
list(form.fields))
@@ -240,9 +237,8 @@
form.save()
self.assertEqual(hostname, node.hostname)
- # XXX JeroenVermeulen 2012-04-12, bug=979539: re-enable.
- #self.assertEqual(
- # after_commissioning_action, node.after_commissioning_action)
+ 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-20 16:00:50 +0000
+++ src/maasserver/tests/test_views.py 2012-04-23 06:23:19 +0000
@@ -166,7 +166,8 @@
self.assertTemplateExistsAndContains(
response.content, '#add-node', 'input#id_hostname')
- # XXX JeroenVermeulen 2012-04-12, bug=979539: re-enable.
+ # XXX JeroenVermeulen 2012-04-23, bug=987092: Add back the
+ # after-commissioning dropdown, and re-enable this test.
def t_e_s_t_after_commissioning_action_snippet(self):
response = self.client.get('/')
self.assertTemplateExistsAndContains(
@@ -737,9 +738,8 @@
node_edit_link = reverse('node-edit', args=[node.system_id])
params = {
'hostname': factory.getRandomString(),
- # XXX JeroenVermeulen 2012-04-12, bug=979539: re-enable.
- #'after_commissioning_action': factory.getRandomEnum(
- # NODE_AFTER_COMMISSIONING_ACTION),
+ 'after_commissioning_action': factory.getRandomEnum(
+ NODE_AFTER_COMMISSIONING_ACTION),
}
response = self.client.post(node_edit_link, params)
@@ -884,9 +884,8 @@
node_edit_link = reverse('node-edit', args=[node.system_id])
params = {
'hostname': factory.getRandomString(),
- # XXX JeroenVermeulen 2012-04-12, bug=979539: re-enable.
- #'after_commissioning_action': factory.getRandomEnum(
- # NODE_AFTER_COMMISSIONING_ACTION),
+ 'after_commissioning_action': factory.getRandomEnum(
+ NODE_AFTER_COMMISSIONING_ACTION),
'power_type': factory.getRandomChoice(POWER_TYPE_CHOICES),
}
response = self.client.post(node_edit_link, params)
Follow ups