Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sosreport,reporting] replace HTML reports by Report subclass #1728

Closed

Conversation

pmoravec
Copy link
Contributor

Current HTML report generation is slow and its implementation is full
of scattered html code. We shall utilize Report class instead.

Additionally, add JSON report format for easy automated parsing.

Resolves: #1713

Signed-off-by: Pavel Moravec pmoravec@redhat.com


Please place an 'X' inside each '[]' to confirm you adhere to our Contributor Guidelines

  • Is the commit message split over multiple lines and hard-wrapped at 72 characters?
  • Is the subject and message clear and concise?
  • Does the subject start with [plugin_name] if submitting a plugin patch or a [section_name] if part of the core sosreport code?
  • Does the commit contain a Signed-off-by: First Lastname email@example.com?

@pmoravec pmoravec force-pushed the sos-pmoravec-html-report-efficient branch 2 times, most recently from c7b0a0e to e341407 Compare July 16, 2019 11:33
@pmoravec pmoravec force-pushed the sos-pmoravec-html-report-efficient branch from e341407 to 4d1c2ef Compare August 8, 2019 07:01
@pmoravec
Copy link
Contributor Author

Failed Travis build is some infra issue - python3.4 failed due to network timeout. Not relevant to PR.

@pmoravec
Copy link
Contributor Author

The PR still has an issue:

touch /etc/network_přílišžluťoučkýkůňpělódy
./sosreport -o networking,networkmanager --batch --build
..
Traceback (most recent call last):
  File "./sosreport", line 19, in <module>
    main(sys.argv[1:])
  File "/root/sos-master/sos/sosreport.py", line 1373, in main
    sos.execute()
  File "/root/sos-master/sos/sosreport.py", line 1350, in execute
    self.generate_reports()
  File "/root/sos-master/sos/sosreport.py", line 1151, in generate_reports
    output = class_(report).unicode()
  File "/root/sos-master/sos/reporting.py", line 250, in unicode
    return json.dumps(self.report_data, indent=4, ensure_ascii=False)
  File "/usr/lib64/python2.7/json/__init__.py", line 250, in dumps
    sort_keys=sort_keys, **kw).encode(obj)
  File "/usr/lib64/python2.7/json/encoder.py", line 210, in encode
    return ''.join(chunks)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 17: ordinal not in range(128)

The reason is tricky: some of networkmanager report's leaf objects are unicode strings, which beats with the copied_files containing /etc/network_přílišžluťoučkýkůňpělódy in networking. So we must populate CopiedFile and Command etc. in generate_reports the same way (unicode XOR non-unicode every time).

Current HTML report generation is slow and its implementation is full
of scattered html code. We shall utilize Report class instead.

Additionally, add JSON report format for easy automated parsing.

Further, fixed decoding of unicode content of a report.

Fixed report_tests suite inc. some pycodestyle errors.

Resolves: sosreport#1713

Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
@pmoravec pmoravec force-pushed the sos-pmoravec-html-report-efficient branch from 4d1c2ef to 0d1687c Compare August 16, 2019 07:06
@pmoravec
Copy link
Contributor Author

... and the issue identified and fixed (Reporting class must store data decoded from UTF to prevent mis-match of some stored data as str and some as unicode)

@pmoravec
Copy link
Contributor Author

Closed this in 1e60189 .

@pmoravec pmoravec closed this Aug 25, 2019
@pmoravec pmoravec mentioned this pull request Jul 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[sosreport] format of reports (plain/html/json?)
1 participant