Fix for AC-321. Mark hosts and groups inactive when inventory is marked inactive.

This commit is contained in:
Chris Church
2013-08-04 22:56:07 -04:00
parent 49beca2b97
commit a4af00da85
2 changed files with 58 additions and 1 deletions

View File

@@ -168,6 +168,16 @@ class Inventory(CommonModel):
def get_absolute_url(self):
return reverse('main:inventory_detail', args=(self.pk,))
def mark_inactive(self, save=True):
'''
When marking inventory inactive, also mark hosts and groups inactive.
'''
super(Inventory, self).mark_inactive(save=save)
for host in self.hosts.filter(active=True):
host.mark_inactive()
for group in self.groups.filter(active=True):
group.mark_inactive()
@property
def variables_dict(self):
try: