Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1796540

Summary: json data generated by insights plugin is sometimes not parsable
Product: Red Hat Satellite Reporter: Paul Dudley <pdudley>
Component: RH Cloud - InventoryAssignee: Shimon Shtein <sshtein>
Status: CLOSED CURRENTRELEASE QA Contact: Mirek Długosz <mzalewsk>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.6.0CC: aganbat, bkearney, cdonnell, fsilva, gtaylor, john.berninger, mzalewsk, sshtein, wpinheir
Target Milestone: UnspecifiedKeywords: PrioBumpGSS, Triaged, UserExperience
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-05-01 12:22:15 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Paul Dudley 2020-01-30 16:43:30 UTC
When analyzing the json data inside RH inventory tar file - report_for_1.tar.gz - the json data is not parsable. For example:

───────────────────────────────────
[root@iridium tmp]# cat 49154599-35a5-4be7-a6ba-9d9ec9b72c59.json | json_reformat
...
                    "libselinux-2.5-11.el7.x86_64",
parse error: unallowed token at this point in JSON text
                                        6_64", "nss-util-3.28.4-3.el7.
                     (right here) ------^
                    "info-5.1-4.el7.x86_64"
───────────────────────────────────
[root@iridium tmp]# cat 49154599-35a5-4be7-a6ba-9d9ec9b72c59.json | python -m json.tool
No JSON object could be decoded
───────────────────────────────────

The problem appears to be that the parsers fail to prettify json output when they encounter a string of commas and spaces, here:

───────────────────────────────────
[root@iridium tmp]# cat 49154599-35a5-4be7-a6ba-9d9ec9b72c59.json | grep -o ', , ,' | wc -l
76
───────────────────────────────────

And for a generated json file that parses without error:
───────────────────────────────────
╰─ cat 242724c2-9cd6-465d-b8d0-8320d57c97ce.json | grep -o ', , ,' | wc -l
0
───────────────────────────────────

Customers who want to view the report information will not be able to if the information is not parsable with these tools.

Comment 3 Shimon Shtein 2020-02-02 06:32:35 UTC
Can you please attach the report (or json) to see which fields generate such an output?

Comment 5 Paul Dudley 2020-02-03 15:41:15 UTC
The report can be successfully parsed after removing the extra commas and spaces:
───────────────────────────────────
[root@iridium ~]# grep -o fqdn 566cdc6d-fd70-4e04-9277-b0afba5e0a82.json  | python -m json.tool
No JSON object could be decoded
───────────────────────────────────
Number of host entries:
[root@iridium ~]# grep -o fqdn 566cdc6d-fd70-4e04-9277-b0afba5e0a82.json  | wc -l
586

Removing extra commas and spaces:
[root@iridium ~]# cat 566cdc6d-fd70-4e04-9277-b0afba5e0a82.json | tr ' ' '\n' | sed 's/^,//g' | tr -d '\n' | python -m json.tool | tail -n5
            "vm_uuid": "5a2f8602-ea12-4685-ad5c-c919cc8b2d5f"
        }
    ],
    "report_slice_id": "566cdc6d-fd70-4e04-9277-b0afba5e0a82"
}
───────────────────────────────────
The same number of hosts is kept after this editing:
[root@iridium ~]# cat 566cdc6d-fd70-4e04-9277-b0afba5e0a82.json | tr ' ' '\n' | sed 's/^,//g' | tr -d '\n' | python -m json.tool | grep fqdn | wc -l
586

It should be noted that the number of hosts in the report does not match the number of hosts in the Satellite:
───────────────────────────────────
[root@iridium ~]# hammer host list | wc -l
858
───────────────────────────────────
[root@iridium ~]# grep -o fqdn 566cdc6d-fd70-4e04-9277-b0afba5e0a82.json  | wc -l
586

Comment 7 Shimon Shtein 2020-04-07 16:36:36 UTC
*** Bug 1809297 has been marked as a duplicate of this bug. ***

Comment 13 Bryan Kearney 2020-05-01 12:22:15 UTC
I am closing this out as it was delivered in Satelilte 6.6.3.