Merge pull request #6489 from wenottingham/that-ain't-right

Don't return different fields for smart vs non-smart inventories

Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
softwarefactory-project-zuul[bot]
2020-03-31 17:43:03 +00:00
committed by GitHub

View File

@@ -122,7 +122,7 @@ def cred_type_counts(since):
return counts return counts
@register('inventory_counts', '1.0') @register('inventory_counts', '1.1')
def inventory_counts(since): def inventory_counts(since):
counts = {} counts = {}
for inv in models.Inventory.objects.filter(kind='').annotate(num_sources=Count('inventory_sources', distinct=True), for inv in models.Inventory.objects.filter(kind='').annotate(num_sources=Count('inventory_sources', distinct=True),
@@ -136,8 +136,8 @@ def inventory_counts(since):
for smart_inv in models.Inventory.objects.filter(kind='smart'): for smart_inv in models.Inventory.objects.filter(kind='smart'):
counts[smart_inv.id] = {'name': smart_inv.name, counts[smart_inv.id] = {'name': smart_inv.name,
'kind': smart_inv.kind, 'kind': smart_inv.kind,
'num_hosts': smart_inv.hosts.count(), 'hosts': smart_inv.hosts.count(),
'num_sources': smart_inv.inventory_sources.count() 'sources': smart_inv.inventory_sources.count()
} }
return counts return counts