Bug 1817553 - metadata.json "number_hosts" does not match number of items in "hosts" array in slice
Summary: metadata.json "number_hosts" does not match number of items in "hosts" array ...
Keywords:
Status: CLOSED DUPLICATE of bug 1812858
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: RH Cloud - Inventory
Version: 6.7.0
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: 6.8.0
Assignee: Shimon Shtein
QA Contact: Mirek Długosz
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-03-26 14:58 UTC by Mirek Długosz
Modified: 2020-05-19 15:55 UTC (History)
0 users

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-03-29 15:40:15 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
metadata.json (190 bytes, text/plain)
2020-03-26 15:00 UTC, Mirek Długosz
no flags Details
ff45bb65-e965-4ddd-a05d-86059aa13185.json (18.35 KB, text/plain)
2020-03-26 15:02 UTC, Mirek Długosz
no flags Details

Description Mirek Długosz 2020-03-26 14:58:39 UTC
While smoke-testing the plugin, I get report where metadata.json "number_hosts" is 2, but "hosts" array in another json file has only one item:

#v+
$ cat metadata.json 
{"report_id": "11a5300c-6a02-464a-a5fb-9dd7cc1e537c","host_inventory_api_version": "1.0","source": "Satellite","report_slices": {"ff45bb65-e965-4ddd-a05d-86059aa13185": {"number_hosts": 2}}}
$ python3 -c 'import json; print(len(json.load(open("ff45bb65-e965-4ddd-a05d-86059aa13185.json"))["hosts"]))'
1
#v-

I don't have report itself, but I found json files on Satellite filesystem - attaching them to bugzilla.

I could reproduce that right after I registered one host in default organization of Satellite.

Later I registered more hosts, and metadata number matched number of hosts. When I removed all hosts except one, metadata says there is only one host - as expected.

I also registered new host on another organization, but here again - metadata number matches number of hosts.


So this *might* happen only for first host registered in default organization, which would not be a big deal. But this might also creep up in other circumstances, so I think it's good idea to double-check code responsible for that part.


Found on plugin version 1.0.4, Satellite 6.7 snap 17.

Comment 2 Mirek Długosz 2020-03-26 15:00:50 UTC
Created attachment 1673818 [details]
metadata.json

Comment 3 Mirek Długosz 2020-03-26 15:02:21 UTC
Created attachment 1673819 [details]
ff45bb65-e965-4ddd-a05d-86059aa13185.json

Comment 4 Shimon Shtein 2020-03-29 15:40:15 UTC

*** This bug has been marked as a duplicate of bug 1812858 ***


Note You need to log in before you can comment on or make changes to this bug.