Bug 1461060 - SDK4 fails when handling data with accents using Python2
SDK4 fails when handling data with accents using Python2
Status: CLOSED CURRENTRELEASE
Product: ovirt-engine-sdk-python
Classification: oVirt
Component: Core (Show other bugs)
4.1.4
Unspecified Unspecified
unspecified Severity high (vote)
: ovirt-4.1.5
: 4.1.6
Assigned To: Juan Hernández
Radim Hrazdil
: Regression
Depends On:
Blocks: 1477950 1479479
  Show dependency treegraph
 
Reported: 2017-06-13 08:42 EDT by nicolas
Modified: 2017-08-23 04:01 EDT (History)
6 users (show)

See Also:
Fixed In Version: python-ovirt-engine-sdk4-4.1.6
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-08-23 04:01:42 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: Infra
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
rule-engine: ovirt‑4.1+
rule-engine: blocker+
lsvaty: testing_ack+


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
oVirt gerrit 78112 master MERGED Fix parsing of multi-byte UTF-8 characters 2017-06-15 04:49 EDT
oVirt gerrit 78209 sdk_4.1 MERGED Fix parsing of multi-byte UTF-8 characters 2017-06-15 04:50 EDT

  None (edit)
Description nicolas 2017-06-13 08:42:29 EDT
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 02:27:27 EDT
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 08:39:20 EDT
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 08:39:27 EDT
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 03:17:57 EDT
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 04:00:41 EDT
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.