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
commit 13faa0ed2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -122,7 +122,7 @@ def cred_type_counts(since):
return counts
@register('inventory_counts', '1.0')
@register('inventory_counts', '1.1')
def inventory_counts(since):
counts = {}
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'):
counts[smart_inv.id] = {'name': smart_inv.name,
'kind': smart_inv.kind,
'num_hosts': smart_inv.hosts.count(),
'num_sources': smart_inv.inventory_sources.count()
'hosts': smart_inv.hosts.count(),
'sources': smart_inv.inventory_sources.count()
}
return counts