Added variable data field and resource on inventory. Updated inventory script to output inventory variables for the 'all' group.

This commit is contained in:
Chris Church
2013-06-14 20:09:55 -04:00
parent d47ea40d60
commit abd81b7492
10 changed files with 326 additions and 13 deletions

View File

@@ -171,11 +171,17 @@ class Inventory(CommonModel):
unique_together = (("name", "organization"),)
organization = models.ForeignKey(Organization, null=False, related_name='inventories')
variables = models.TextField(blank=True, default='', null=True)
has_active_failures = models.BooleanField(default=False)
def get_absolute_url(self):
return reverse('main:inventory_detail', args=(self.pk,))
@property
def variables_dict(self):
# FIXME: Add YAML support.
return json.loads(self.variables or '{}')
def update_has_active_failures(self):
failed_hosts = self.hosts.filter(active=True, has_active_failures=True)
self.has_active_failures = bool(failed_hosts.count())