launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #12765
[Merge] lp:~rvb/maas/bug-1059954 into lp:maas
Raphaël Badin has proposed merging lp:~rvb/maas/bug-1059954 into lp:maas.
Commit message:
Add a method to delete a nodegroupinterface.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #1059954 in MAAS: "no easy way to delete a dhcp configuration through the maas-cli"
https://bugs.launchpad.net/maas/+bug/1059954
For more details, see:
https://code.launchpad.net/~rvb/maas/bug-1059954/+merge/127441
Add a method to delete a nodegroupinterface.
--
https://code.launchpad.net/~rvb/maas/bug-1059954/+merge/127441
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rvb/maas/bug-1059954 into lp:maas.
=== modified file 'src/maasserver/api.py'
--- src/maasserver/api.py 2012-10-02 07:20:42 +0000
+++ src/maasserver/api.py 2012-10-02 09:38:23 +0000
@@ -1226,6 +1226,14 @@
else:
raise ValidationError(form.errors)
+ def delete(self, request, uuid, interface):
+ """Delete a specific NodeGroupInterface."""
+ nodegroup = get_object_or_404(NodeGroup, uuid=uuid)
+ nodegroupinterface = get_object_or_404(
+ NodeGroupInterface, nodegroup=nodegroup, interface=interface)
+ nodegroupinterface.delete()
+ return rc.DELETED
+
@classmethod
def resource_uri(cls, nodegroup=None, interface=None):
if nodegroup is None:
=== modified file 'src/maasserver/tests/test_api.py'
--- src/maasserver/tests/test_api.py 2012-10-02 07:20:42 +0000
+++ src/maasserver/tests/test_api.py 2012-10-02 09:38:23 +0000
@@ -3196,6 +3196,19 @@
(httplib.OK, new_ip_range_high),
(response.status_code, reload_object(interface).ip_range_high))
+ def test_delete_interface(self):
+ self.become_admin()
+ nodegroup = factory.make_node_group()
+ interface = nodegroup.get_managed_interface()
+ response = self.client.delete(
+ reverse(
+ 'nodegroupinterface_handler',
+ args=[nodegroup.uuid, interface.interface]))
+ self.assertEqual(httplib.NO_CONTENT, response.status_code)
+ self.assertFalse(
+ NodeGroupInterface.objects.filter(
+ interface=interface.interface, nodegroup=nodegroup).exists())
+
def explain_unexpected_response(expected_status, response):
"""Return human-readable failure message: unexpected http response."""