Bug 1360779 - [sdk-v4] calls to engine are failing when connection was made specifying v4 in engine url
Summary: [sdk-v4] calls to engine are failing when connection was made specifying v4 ...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine-sdk-python
Classification: oVirt
Component: Core
Version: 4.0.0a
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: ovirt-4.0.4
: 4.0.0.a6
Assignee: Ondra Machacek
QA Contact: Petr Matyáš
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-07-27 13:08 UTC by sefi litmanovich
Modified: 2016-09-26 12:33 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-09-26 12:33:43 UTC
oVirt Team: Infra
Embargoed:
rule-engine: ovirt-4.0.z+
mgoldboi: planning_ack+
omachace: devel_ack+
pstehlik: testing_ack+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 61550 0 master MERGED Support /v4 suffix in API URL 2016-07-28 10:26:42 UTC
oVirt gerrit 61610 0 sdk_4.0 MERGED Support /v4 suffix in API URL 2016-07-28 10:29:55 UTC

Description sefi litmanovich 2016-07-27 13:08:02 UTC
Description of problem:
Failed to initiate a connection to the engine with the new v4 sdk if specified the version number in url:

import ovirtsdk4 as sdk
import ovirtsdk4.types as types
api = sdk.Connection(url="https://{engine_url}/ovirt-engine/api/v4", username='{user@domain}', password='{pass}', insecure=True)
vm_pool_service = api.system_service().vm_pools_service()
vm_pool_service.list()
Traceback (most recent call last):
  File "<input>", line 1, in <module>
    vm_pool_service.list()
  File "/usr/lib64/python2.7/site-packages/ovirtsdk4/services.py", line 20254, in list
    response = self._connection.send(request)
  File "/usr/lib64/python2.7/site-packages/ovirtsdk4/__init__.py", line 281, in send
    return self.__send(request)
  File "/usr/lib64/python2.7/site-packages/ovirtsdk4/__init__.py", line 292, in __send
    self._sso_token = self._get_access_token()
  File "/usr/lib64/python2.7/site-packages/ovirtsdk4/__init__.py", line 450, in _get_access_token
    sso_response = self._get_sso_response(self._sso_url)
  File "/usr/lib64/python2.7/site-packages/ovirtsdk4/__init__.py", line 488, in _get_sso_response
    return json.loads(body_buf.getvalue().decode('utf-8'))
  File "/usr/lib64/python2.7/json/__init__.py", line 338, in loads
    return _default_decoder.decode(s)
  File "/usr/lib64/python2.7/json/decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib64/python2.7/json/decoder.py", line 384, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

Works fine when connecting with url without the v4 flag in the url.


Version-Release number of selected component (if applicable):
python-ovirt-engine-sdk4-4.0.0-0.5.a5.el7ev.x86_64

How reproducible:
seems to happen always.

Steps to Reproduce:
as mentioned above.

Actual results:
couldn't get the list of vm pools in this specific case (happens with all entities).

Expected results:
succeed to get list of all entities as normal.

Comment 1 Red Hat Bugzilla Rules Engine 2016-07-27 14:48:06 UTC
Bug tickets must have version flags set prior to targeting them to a release. Please ask maintainer to set the correct version flags and only then set the target milestone.

Comment 2 Juan Hernández 2016-07-27 14:59:06 UTC
I am setting severity to "low" because the issue can be avoided just removing the "/v4" suffix, the SDK always sends the "Version: 4" header anyhow.

Comment 3 Petr Matyáš 2016-09-13 08:16:22 UTC
Verified on 4.0.4-3


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