mirror of
https://github.com/ansible/awx.git
synced 2026-03-13 15:09:32 -02:30
Disable automatic deletion of a group when it has no more parents to support new UI inventory tree changes.
This commit is contained in:
@@ -673,7 +673,7 @@ class InventoryTest(BaseTest):
|
|||||||
data = {'id': removed_group.pk, 'disassociate': 1}
|
data = {'id': removed_group.pk, 'disassociate': 1}
|
||||||
self.post(parent_children_url, data, expect=204, auth=self.get_super_credentials())
|
self.post(parent_children_url, data, expect=204, auth=self.get_super_credentials())
|
||||||
removed_group = Group.objects.get(pk=result['id'])
|
removed_group = Group.objects.get(pk=result['id'])
|
||||||
self.assertFalse(removed_group.active)
|
#self.assertFalse(removed_group.active) # FIXME: Disabled for now because automatically deleting group with no parents is also disabled.
|
||||||
|
|
||||||
# Removing a group from a hierarchy should migrate its children to the
|
# Removing a group from a hierarchy should migrate its children to the
|
||||||
# parent. The group itself will be deleted (marked inactive), and all
|
# parent. The group itself will be deleted (marked inactive), and all
|
||||||
@@ -686,9 +686,9 @@ class InventoryTest(BaseTest):
|
|||||||
with self.current_user(self.super_django_user):
|
with self.current_user(self.super_django_user):
|
||||||
response = self.post(url, data, expect=204)
|
response = self.post(url, data, expect=204)
|
||||||
gx3 = Group.objects.get(pk=gx3.pk)
|
gx3 = Group.objects.get(pk=gx3.pk)
|
||||||
self.assertFalse(gx3.active)
|
#self.assertFalse(gx3.active) # FIXME: Disabled for now....
|
||||||
self.assertFalse(gx3 in gx2.children.all())
|
self.assertFalse(gx3 in gx2.children.all())
|
||||||
self.assertTrue(gx4 in gx2.children.all())
|
#self.assertTrue(gx4 in gx2.children.all())
|
||||||
|
|
||||||
# Try with invalid hostnames and invalid IPs.
|
# Try with invalid hostnames and invalid IPs.
|
||||||
hosts = reverse('main:host_list')
|
hosts = reverse('main:host_list')
|
||||||
|
|||||||
@@ -515,7 +515,7 @@ class GroupChildrenList(SubListCreateAPIView):
|
|||||||
parent_model = Group
|
parent_model = Group
|
||||||
relationship = 'children'
|
relationship = 'children'
|
||||||
|
|
||||||
def unattach(self, request, *args, **kwargs):
|
def _unattach(self, request, *args, **kwargs): # FIXME: Disabled for now for UI support.
|
||||||
'''
|
'''
|
||||||
Special case for disassociating a child group from the parent. If the
|
Special case for disassociating a child group from the parent. If the
|
||||||
child group has no more parents, then automatically mark it inactive.
|
child group has no more parents, then automatically mark it inactive.
|
||||||
|
|||||||
Reference in New Issue
Block a user