launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #14135
[Merge] lp:~jtv/maas/1.2-bug-1077075 into lp:maas/1.2
Jeroen T. Vermeulen has proposed merging lp:~jtv/maas/1.2-bug-1077075 into lp:maas/1.2.
Commit message:
Backport trunk r1344: Fix oops when renaming accepted nodegroup without interfaces.
Requested reviews:
MAAS Maintainers (maas-maintainers)
Related bugs:
Bug #1077075 in MAAS: "Oops when renaming nodegroup w/o interface"
https://bugs.launchpad.net/maas/+bug/1077075
For more details, see:
https://code.launchpad.net/~jtv/maas/1.2-bug-1077075/+merge/133727
Fixes bug 1077075 in Quantal. Backported from trunk without changes.
Jeroen
--
https://code.launchpad.net/~jtv/maas/1.2-bug-1077075/+merge/133727
Your team MAAS Maintainers is requested to review the proposed merge of lp:~jtv/maas/1.2-bug-1077075 into lp:maas/1.2.
=== modified file 'src/maasserver/forms.py'
--- src/maasserver/forms.py 2012-11-08 09:14:58 +0000
+++ src/maasserver/forms.py 2012-11-09 18:17:21 +0000
@@ -833,6 +833,11 @@
return new_name
interface = self.instance.get_managed_interface()
+ if interface is None:
+ # No network interfaces. It's weird, but there certainly
+ # won't be a problem with the name change.
+ return new_name
+
if interface.management != NODEGROUPINTERFACE_MANAGEMENT.DHCP_AND_DNS:
# MAAS is not managing DNS on this network, so the user can
# rename the zone at will.
=== modified file 'src/maasserver/tests/test_forms.py'
--- src/maasserver/tests/test_forms.py 2012-10-30 15:15:30 +0000
+++ src/maasserver/tests/test_forms.py 2012-11-09 18:17:21 +0000
@@ -57,6 +57,7 @@
MACAddress,
Node,
NodeGroup,
+ NodeGroupInterface,
)
from maasserver.models.config import DEFAULT_CONFIG
from maasserver.node_action import (
@@ -992,3 +993,13 @@
self.assertTrue(form.is_valid())
form.save()
self.assertEqual(data['name'], reload_object(nodegroup).name)
+
+ def test_accepts_name_change_if_nodegroup_has_no_interface(self):
+ nodegroup, node = make_unrenamable_nodegroup_with_node()
+ NodeGroupInterface.objects.filter(nodegroup=nodegroup).delete()
+ data = self.make_form_data(nodegroup)
+ data['name'] = factory.make_name('new-name')
+ form = NodeGroupEdit(instance=nodegroup, data=data)
+ self.assertTrue(form.is_valid())
+ form.save()
+ self.assertEqual(data['name'], reload_object(nodegroup).name)