[ovirt-devel] Can't add DC with API v4 - client issue

Ondra Machacek omachace at redhat.com
Mon Oct 10 07:33:47 UTC 2016


On 10/07/2016 09:44 PM, Yaniv Kaul wrote:
> I'm trying on FC24, using
> python-ovirt-engine-sdk4-4.1.0-0.0.20161003git056315d.fc24.x86_64 to add
> a DC, and failing - against master. The client is unhappy:
> File
> "/home/ykaul/ovirt-system-tests/basic-suite-master/test-scenarios/002_bootstrap.py",
> line 98, in add_dc4
>     version=sdk4.types.Version(major=DC_VER_MAJ,minor=DC_VER_MIN),
>   File "/usr/lib64/python2.7/site-packages/ovirtsdk4/services.py", line
> 4347, in add
>     response = self._connection.send(request)
>   File "/usr/lib64/python2.7/site-packages/ovirtsdk4/__init__.py", line
> 276, in send
>     return self.__send(request)
>   File "/usr/lib64/python2.7/site-packages/ovirtsdk4/__init__.py", line
> 298, in __send
>     self._sso_token = self._get_access_token()
>   File "/usr/lib64/python2.7/site-packages/ovirtsdk4/__init__.py", line
> 460, in _get_access_token
>     sso_response = self._get_sso_response(self._sso_url, post_data)
>   File "/usr/lib64/python2.7/site-packages/ovirtsdk4/__init__.py", line
> 498, in _get_sso_response
>     return json.loads(body_buf.getvalue().decode('utf-8'))
>   File "/usr/lib64/python2.7/json/__init__.py", line 339, in loads
>     return _default_decoder.decode(s)
>   File "/usr/lib64/python2.7/json/decoder.py", line 364, in decode
>     obj, end = self.raw_decode(s, idx=_w(s, 0).end())
>   File "/usr/lib64/python2.7/json/decoder.py", line 382, in raw_decode
>     raise ValueError("No JSON object could be decoded")
> ValueError: No JSON object could be decoded
>

This error means something wrong during authentication.
The JSON SSO response returned something unexpected.

Anyway I've tried with current master and everything is fine for me.

Can you please send debug log of the SDK?

import loggging
logging.basicConfig(level=logging.DEBUG, filename='/tmp/debug.log')

return sdk4.Connection(
   url=url,
   username=constants.ENGINE_USER,
   password=str(self.metadata['ovirt-engine-password']),
   insecure=True,
   log=logging.getLogger(),
   debug=True,
)

>
> Surprisingly, I now can't find that RPM of this SDK in
> resources.ovirt.org <http://resources.ovirt.org> now.
>
> I've tried
> with http://resources.ovirt.org/pub/ovirt-master-snapshot/rpm/fc24/x86_64/python-ovirt-engine-sdk4-4.0.0-0.1.20161004gitf94eeb5.fc24.x86_64.rpm
> <http://resources.ovirt.org/pub/ovirt-master-snapshot/rpm/fc24/x86_64/python-ovirt-engine-sdk4-4.0.0-0.1.20161004gitf94eeb5.fc24.x86_64.rpm>
>
> - same result.
>
> Did not see anything obvious on server or engine logs.
> The code:
> def add_dc4(api):
>     nt.assert_true(api != None)
>     dcs_service = api.system_service().data_centers_service()
>     nt.assert_true(
>         dc = dcs_service.add(
>             sdk4.types.DataCenter(
>                 name=DC_NAME4,
>                 description='APIv4 DC',
>                 local=False,
>
> version=sdk4.types.Version(major=DC_VER_MAJ,minor=DC_VER_MIN),
>             ),
>         )
>     )
>
>
> And the api object is from:
>             return sdk4.Connection(
>                 url=url,
>                 username=constants.ENGINE_USER,
>                 password=str(self.metadata['ovirt-engine-password']),
>                 insecure=True,
>                 debug=True,
>             )
>
>
>
> _______________________________________________
> Devel mailing list
> Devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/devel
>



More information about the Devel mailing list