Bug 1461060 - SDK4 fails when handling data with accents using Python2
Summary: SDK4 fails when handling data with accents using Python2
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine-sdk-python
Classification: oVirt
Component: Core
Version: 4.1.4
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ovirt-4.1.5
: 4.1.6
Assignee: Juan Hernández
QA Contact: Radim Hrazdil
URL:
Whiteboard:
Depends On:
Blocks: 1477950 1479479
TreeView+ depends on / blocked
 
Reported: 2017-06-13 12:42 UTC by nicolas
Modified: 2017-08-23 08:01 UTC (History)
6 users (show)

Fixed In Version: python-ovirt-engine-sdk4-4.1.6
Clone Of:
Environment:
Last Closed: 2017-08-23 08:01:42 UTC
oVirt Team: Infra
Embargoed:
rule-engine: ovirt-4.1+
rule-engine: blocker+
lsvaty: testing_ack+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 78112 0 master MERGED Fix parsing of multi-byte UTF-8 characters 2017-06-15 08:49:54 UTC
oVirt gerrit 78209 0 sdk_4.1 MERGED Fix parsing of multi-byte UTF-8 characters 2017-06-15 08:50:08 UTC

Description nicolas 2017-06-13 12:42:29 UTC
Description of problem:

We're running Python SDK (ovirt-engine-sdk-python) ver 4.1.4 and we're having some issues getting values that contain accents. For example, this snippet fails, because one of the returned values contains a accent:

   import ovirtsdk4 as sdk
   import ovirtsdk4.types as types

   # Create the connection to the server:
   connection = sdk.Connection(
       url='https://fqdn/ovirt-engine/api',
       username='...',
       password='...',
       ca_file='...',
       debug=True,
   )

   users_service = connection.system_service().users_service()
   users = users_service.list()

   connection.close()

Version-Release number of selected component (if applicable):

SDK 4.1.4

How reproducible:

Always

Steps to Reproduce:
1. Create a user which has an accent in their name or surname.
2. Run the snippet above.

Actual results:

The snippet above fails in the "users = users_service.list()" line, because one of the records has an accent (ó).

The trace is:
Traceback (most recent call last):
 File "lista_users", line 23, in <module>
   users = users_service.list()
 File
"/home/ovirt/prueba/ejemplo2/lib/python2.7/site-packages/ovirtsdk4/services.py",
line 22155, in list
   return self._internal_get(headers, query, wait)
 File
"/home/ovirt/prueba/ejemplo2/lib/python2.7/site-packages/ovirtsdk4/service.py",
line 202, in _internal_get
   return future.wait() if wait else future
 File
"/home/ovirt/prueba/ejemplo2/lib/python2.7/site-packages/ovirtsdk4/service.py",
line 53, in wait
   return self._code(response)
 File
"/home/ovirt/prueba/ejemplo2/lib/python2.7/site-packages/ovirtsdk4/service.py",
line 197, in callback
   return self._internal_read_body(response)
 File
"/home/ovirt/prueba/ejemplo2/lib/python2.7/site-packages/ovirtsdk4/service.py",
line 310, in _internal_read_body
   return reader.Reader.read(response.body)
 File
"/home/ovirt/prueba/ejemplo2/lib/python2.7/site-packages/ovirtsdk4/reader.py",
line 297, in read
   cursor = xml.XmlReader(io.BytesIO(source.encode('utf-8')))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
1899: ordinal not in range(128)

Expected results:

It should handle the accent situation.

Additional info:

Using version 4.1.3 doesn't throw the exception. It's only version 4.1.4 that fails.

Comment 1 Red Hat Bugzilla Rules Engine 2017-06-14 06:27:27 UTC
This bug report has Keywords: Regression or TestBlocker.
Since no regressions or test blockers are allowed between releases, it is also being identified as a blocker for this release. Please resolve ASAP.

Comment 2 Radim Hrazdil 2017-08-02 12:39:20 UTC
Moving back to assigned since in 4.1.5-1 includes sdk version 4.1.5-1.
Either add new SDK version (4.1.6) or move target milestone so that it includes SDK version 4.1.6.

[root@rh-vm02 yum.repos.d]# yum list python-ovirt-engine-sdk4
Installed Packages
python-ovirt-engine-sdk4.x86_64         4.1.5-1.el7ev         @rhv-4.1.5

Comment 3 Red Hat Bugzilla Rules Engine 2017-08-02 12:39:27 UTC
Target release should be placed once a package build is known to fix a issue. Since this bug is not modified, the target version has been reset. Please use target milestone to plan a fix for a oVirt release.

Comment 4 Martin Perina 2017-08-03 07:17:57 UTC
Moving back to ON_QA, as 4.1.6 build was attached RHV 4.1.5 yesterday, so it should be part of this week's compose. And of course you can always download it directly from errata [1].

[1] https://errata.devel.redhat.com/advisory/29665

Comment 5 Radim Hrazdil 2017-08-03 08:00:41 UTC
Verified that user names with accents are printed correctly.


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