Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 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 "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". 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 "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-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 1315369

Summary: atomic scan generates invalid json
Product: Red Hat Enterprise Linux 7 Reporter: Jan Černý <jcerny>
Component: atomicAssignee: Lokesh Mandvekar <lsm5>
Status: CLOSED CURRENTRELEASE QA Contact: atomic-bugs <atomic-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.2CC: bbaude, dwalsh, pthomas
Target Milestone: rcKeywords: Extras
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-05-05 14:45:19 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:
Bug Depends On: 1343939, 1343944, 1346942    
Bug Blocks:    

Description Jan Černý 2016-03-07 14:56:48 UTC
Description of problem:
JSON output of atomic scan contains string "Scanning..." before the actual JSON starts, which is invalid JSON syntax.

Version-Release number of selected component (if applicable):
atomic-1.6-6.gitca1e384.el7.x86_64

How reproducible:
always

Steps to Reproduce:
1. atomic scan <ID> --json

Actual results:
JSON is preceded by "\nScanning...\n"

Expected results:
Only JSON on stdout.

Additional info:
I have found that the issue has been fixed upstream in https://github.com/projectatomic/atomic/commit/7ce96abdda930d9716e48479cb3c0cd080fe263b

Comment 2 Alex Jia 2016-03-08 03:27:13 UTC
(In reply to Jan Černý from comment #0)
> Additional info:
> I have found that the issue has been fixed upstream in
> https://github.com/projectatomic/atomic/commit/
> 7ce96abdda930d9716e48479cb3c0cd080fe263b

Yes, the patch has been backported to v1.6.

[root@dell-per630-02 atomic]# git tag --contains 7ce96ab
v1.6
v1.8

[root@dell-per630-02 atomic]# git branch
* (detached from v1.6)
  jzb-patch-1
  master

[root@dell-per630-02 atomic]# git show 7ce96ab
commit 7ce96abdda930d9716e48479cb3c0cd080fe263b
Author: Dan Walsh <dwalsh>
Date:   Mon Nov 23 08:22:35 2015 -0500

    Don't output Scanning, user knows that

diff --git a/Atomic/atomic.py b/Atomic/atomic.py
index 85312bb..a668037 100644
--- a/Atomic/atomic.py
+++ b/Atomic/atomic.py
@@ -472,7 +472,6 @@ class Atomic(object):
                                  "use) and therefore cannot be scanned.\n"
                                  .format(docker_obj))
                 sys.exit(1)
-        util.writeOut("\nScanning...\n")
         bus = dbus.SystemBus()
         try:
             oscap_d = bus.get_object(BUS_NAME, OBJECT_PATH)

Comment 3 Alex Jia 2016-03-08 03:33:00 UTC
(In reply to Alex Jia from comment #2)
> Yes, the patch has been backported to v1.6.

s/backported/cherry-pick/

Comment 4 Daniel Walsh 2016-06-03 19:56:50 UTC
Fixed in atomic-1.10

Comment 7 Daniel Walsh 2016-06-12 10:49:22 UTC
Brent please comment on this.

Comment 8 Brent Baude 2016-06-13 14:32:10 UTC
The --json switch was removed in the following commit ->

https://github.com/projectatomic/atomic/commit/6ed4994b0d6091ccfe171b9c8e48714c53a868d6

For the record, with the re-design of the scanner at that time, atomic no longer forms the JSON output that is stored in the filesystem.  This is always done by the scanners themselves.

Comment 9 Alex Jia 2016-06-14 10:11:48 UTC
(In reply to Brent Baude from comment #8)
> The --json switch was removed in the following commit ->
> 
> https://github.com/projectatomic/atomic/commit/
> 6ed4994b0d6091ccfe171b9c8e48714c53a868d6
> 
> For the record, with the re-design of the scanner at that time, atomic no
> longer forms the JSON output that is stored in the filesystem.  This is
> always done by the scanners themselves.

Brent, okay, because the --json switch has been removed, and I can't give a further testing due to bug 1343944 and 1343939, so I tend to close the bug.

Comment 10 Lokesh Mandvekar 2016-06-15 14:43:58 UTC
Brent, can we remove this bug from the advisory?

Comment 11 Brent Baude 2016-06-15 15:16:43 UTC
I dont see why not.  Do others object?

Comment 12 Lokesh Mandvekar 2016-06-15 15:19:27 UTC
Not really, just wanted to make sure :)

Comment 14 Alex Jia 2016-06-16 10:31:23 UTC
Just a record, atomic scan will put test report in *.xml and json format under the /var/lib/atomic/openscap/$date/$image_id/, I used python -m json.tool to check /var/lib/atomic/openscap/$date/$image_id/json, it's valid json format, so I tend to close the bug as VERIFIED.