Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1066036 - Connection via python-sdk failed
Summary: Connection via python-sdk failed
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: oVirt
Classification: Retired
Component: ovirt-engine-sdk
Version: 3.4
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: 3.4.0
Assignee: Juan Hernández
QA Contact: Petr Beňas
URL:
Whiteboard: infra
: 1069685 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-02-17 14:40 UTC by Artyom
Modified: 2015-01-04 23:05 UTC (History)
8 users (show)

Fixed In Version: ovirt-engine-sdk-python-3.4.0.4-1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-03-31 12:27:06 UTC
oVirt Team: ---


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
oVirt gerrit 24595 None None None Never
oVirt gerrit 24623 None None None Never

Description Artyom 2014-02-17 14:40:20 UTC
Description of problem:
Connection via python-sdk failed with not informative error:
[ERROR]::Server reply is in inappropriate format.

Version-Release number of selected component (if applicable):
ovirt-engine-sdk-python-3.4.0.1-1.20140112.git3d7b90e.el6.noarch
ovirt-engine-3.4.0-0.7.beta2.el6.noarch

How reproducible:
Always

Steps to Reproduce:
1. Create some small python script:
from ovirtsdk.api import API
import sys

def get_connection():
        #open a connection to the rest api
        connection = None
        try:
            connection = API(url='https://your_engine',
                             username='admin@internal', password='123456',
                             ca_file='ca.crt')
        except BaseException as ex:
            #letting the external proxy know there was an error
            print >> sys.stderr, ex
            return None

        return connection

api = get_connection()

vm_list = api.vms.list()

for vm in vm_list:
    print vm.get_name()

sure you need to download ca.crt via wget http://your_engine/ca.crt

2. run python your_script.py 
3.

Actual results:
Receive error [ERROR]::Server reply is in inappropriate format, and also exception(because api=None)

Expected results:
script must print all vms in my engine.


Additional info:

Comment 1 Juan Hernández 2014-02-17 14:47:40 UTC
Isn't this script using an incorrect URL:

  url='https://your_engine'

It is missing the /api part.

Comment 2 Artyom 2014-02-17 17:16:18 UTC
No, for 3.3 it works fine and also in development guide also use url without /api

Comment 3 Juan Hernández 2014-02-17 17:33:02 UTC
In 3.3 we hardcoded the URL prefix. That has been fixed, and this is a side effect. I think that we should change the documentation to explicitly include the prefix, as that is the correct way to specify the location of the API. Artyom, can you open the corresponding documentation bug?

We will also modify the SDK so that it uses /api by default if the URL provided by the user doesn't have a path.

Comment 4 Artyom 2014-02-17 17:38:58 UTC
No problem I will open documentation bug

Comment 5 Juan Hernández 2014-02-18 13:55:43 UTC
The packages containing the fix for this issue are available here:

http://jhernand.fedorapeople.org/rpms/ovirt-engine-sdk-python/3.4.0.4-1

Comment 6 Petr Beňas 2014-02-20 11:14:06 UTC
Verified in ovirt-engine-sdk-python-3.4.0.4-1.el6.noarch with comment 0 snippet of code.

Comment 7 Juan Hernández 2014-02-25 14:22:13 UTC
*** Bug 1069685 has been marked as a duplicate of this bug. ***

Comment 8 Sandro Bonazzola 2014-03-31 12:27:06 UTC
this is an automated message: moving to Closed CURRENT RELEASE since oVirt 3.4.0 has been released


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