Bug 1866981 - obj must be encoded before hashing
Summary: obj must be encoded before hashing
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine-db-query
Version: 4.4.0
Hardware: All
OS: All
high
high
Target Milestone: ovirt-4.4.3
: 4.4.3
Assignee: Sandro Bonazzola
QA Contact: Guilherme Santos
URL:
Whiteboard:
: 1882702 (view as bug list)
Depends On:
Blocks: 1859314 1885976
TreeView+ depends on / blocked
 
Reported: 2020-08-07 03:02 UTC by Douglas Schilling Landgraf
Modified: 2021-06-02 14:32 UTC (History)
4 users (show)

Fixed In Version: engine-db-query-1.6.2
Doc Type: Bug Fix
Doc Text:
Previously, unicode strings were not handled properly by the ovirt-engine-db-query after porting to Python3. In this release, unicode strings are now handled properly.
Clone Of:
: 1885976 (view as bug list)
Environment:
Last Closed: 2020-11-24 13:09:25 UTC
oVirt Team: Integration
Target Upstream Version:
Embargoed:
gdeolive: testing_plan_complete+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2020:5179 0 None None None 2020-11-24 13:09:49 UTC

Description Douglas Schilling Landgraf 2020-08-07 03:02:36 UTC
Description of problem:

rhv-log-collector-analyzer --json shows this error:

  File "/usr/bin/engine-db-query", line 280, in <module>
    sys.exit(main())
  File "/usr/bin/engine-db-query", line 272, in main
    knowledge_base=args.kb_url
  File "/usr/lib/python3.6/site-packages/engine_db_query/__init__.py", line 213, in execute
    knowledge_base=knowledge_base
  File "/usr/lib/python3.6/site-packages/engine_db_query/__init__.py", line 383, in query_return_json
    s=hashlib.sha256(file_name).hexdigest(),
TypeError: Unicode-objects must be encoded before hashing


NOTE: do not affect --live

Comment 3 Sandro Bonazzola 2020-09-25 14:12:51 UTC
*** Bug 1882702 has been marked as a duplicate of this bug. ***

Comment 5 Pavol Brilla 2020-10-07 11:25:00 UTC
# rhv-analyzer-insights 
Executing rhv-log-collector-analyzer...
Traceback (most recent call last):
  File "/usr/bin/rhv-analyzer-insights", line 122, in <module>
    f.write(json_output)
TypeError: write() argument must be str, not bytes
# yum list rhv-log-collector-analyzer
Updating Subscription Management repositories.
Last metadata expiration check: 0:41:46 ago on Wed 07 Oct 2020 12:41:41 PM CEST.
Installed Packages
rhv-log-collector-analyzer.noarch                               1.0.4-1.el8ev

Comment 6 Sandro Bonazzola 2020-10-07 11:40:12 UTC
(In reply to Pavol Brilla from comment #5)
> # rhv-analyzer-insights 
> Executing rhv-log-collector-analyzer...
> Traceback (most recent call last):
>   File "/usr/bin/rhv-analyzer-insights", line 122, in <module>
>     f.write(json_output)
> TypeError: write() argument must be str, not bytes
> # yum list rhv-log-collector-analyzer
> Updating Subscription Management repositories.
> Last metadata expiration check: 0:41:46 ago on Wed 07 Oct 2020 12:41:41 PM
> CEST.
> Installed Packages
> rhv-log-collector-analyzer.noarch                               1.0.4-1.el8ev

was engine-db-query-1.6.2 installed?

Comment 7 Sandro Bonazzola 2020-10-07 11:47:37 UTC
Enforcing the requirement on engine-db-query >= 1.6.2

Comment 8 Sandro Bonazzola 2020-10-07 11:51:47 UTC
(In reply to Pavol Brilla from comment #5)
> # rhv-analyzer-insights 
> Executing rhv-log-collector-analyzer...
> Traceback (most recent call last):
>   File "/usr/bin/rhv-analyzer-insights", line 122, in <module>
>     f.write(json_output)
> TypeError: write() argument must be str, not bytes

Now noticed, this is on a different binary, original bug was reported against engine-db-query, this one is on rhv-analyzer-insights.
Moving this bug back to ON_QA, opening a different one for above report.


> # yum list rhv-log-collector-analyzer
> Updating Subscription Management repositories.
> Last metadata expiration check: 0:41:46 ago on Wed 07 Oct 2020 12:41:41 PM
> CEST.
> Installed Packages
> rhv-log-collector-analyzer.noarch                               1.0.4-1.el8ev

Comment 9 Pavol Brilla 2020-10-07 13:42:33 UTC
yes it was

yum list engine-db-query

Installed Packages
engine-db-query.noarch                                                        1.6.2-1.el8ev

Comment 10 Guilherme Santos 2020-10-26 13:49:02 UTC
Verified on:
rhv-log-collector-analyzer-1.0.5-1.el8ev.noarch
ovirt-engine-4.4.3-0.1.el8ev.noarch

Steps:
# rhv-log-collector-analyzer --json

Results:
Run went fine and json generated successfully

Comment 11 Eli Marcus 2020-11-22 19:32:03 UTC
Hi Sandro, please review this doc text for the errata and release notes: 

Previously, unicode strings were not handled properly by the ovirt-engine-db-query after porting to Python3. 
In this release, unicode strings are now handled properly.

Comment 12 Sandro Bonazzola 2020-11-23 09:07:38 UTC
(In reply to Eli Marcus from comment #11)
> Hi Sandro, please review this doc text for the errata and release notes: 
> 
> Previously, unicode strings were not handled properly by the
> ovirt-engine-db-query after porting to Python3. 
> In this release, unicode strings are now handled properly.

looks good to me

Comment 16 errata-xmlrpc 2020-11-24 13:09:25 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Low: Red Hat Virtualization security, bug fix, and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2020:5179


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