mirror of
https://github.com/ansible/awx.git
synced 2026-05-14 21:07:39 -02:30
Fix for AC-284. Delete groups when they are disassociated and have no more parents. Remove all group and host associations from a group when it is marked inactive.
This commit is contained in:
@@ -269,6 +269,16 @@ class Group(CommonModelNameNotUnique):
|
||||
def get_absolute_url(self):
|
||||
return reverse('main:group_detail', args=(self.pk,))
|
||||
|
||||
def mark_inactive(self, save=True):
|
||||
'''
|
||||
When marking groups inactive, remove all associations to related
|
||||
groups/hosts.
|
||||
'''
|
||||
super(Group, self).mark_inactive(save=save)
|
||||
self.parents.clear()
|
||||
self.children.clear()
|
||||
self.hosts.clear()
|
||||
|
||||
def update_has_active_failures(self):
|
||||
failed_hosts = self.all_hosts.filter(active=True,
|
||||
last_job_host_summary__job__active=True,
|
||||
|
||||
Reference in New Issue
Block a user