mirror of
https://github.com/ansible/awx.git
synced 2026-05-18 06:47:41 -02:30
Added variable data field and resource on inventory. Updated inventory script to output inventory variables for the 'all' group.
This commit is contained in:
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user