mirror of
https://github.com/ansible/awx.git
synced 2026-05-15 21:37:42 -02:30
Updated inventory script to only return active groups and active hosts for active inventories.
This commit is contained in:
@@ -117,6 +117,15 @@ class PrimordialModel(models.Model):
|
||||
def __unicode__(self):
|
||||
return unicode("%s-%s"% (self.name, self.id))
|
||||
|
||||
def mark_inactive(self, save=True):
|
||||
'''Use instead of delete to rename and mark inactive.'''
|
||||
if self.active:
|
||||
if 'name' in self._meta.get_all_field_names():
|
||||
self.name = "_deleted_%s_%s" % (now().isoformat(), self.name)
|
||||
self.active = False
|
||||
if save:
|
||||
self.save()
|
||||
|
||||
class CommonModel(PrimordialModel):
|
||||
''' a base model where the name is unique '''
|
||||
|
||||
|
||||
Reference in New Issue
Block a user