openstack python connect not working

asked 2016-07-18 06:34:50 -0500

heena gravatar image

I am using below code to connect to Openstack with Python

from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver

provider = get_driver(Provider.OPENSTACK)
conn = provider('admin',
            'redhat',
            ex_force_auth_url='https://192.168.217.142:5000/v2.0', # ( I have tried this without /v2.0 and with /v2.0/tokens as well but getting the same error)
            ex_force_auth_version='2.0_password',
            ex_tenant_name='admin',
            ex_force_service_region='RegionOne')

But I am getting below error on images=conn.list_images()

Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/libcloud/compute/drivers/openstack.py", line 279, in list_images
self.connection.request('/images/detail').object, ex_only_active)
File "/usr/lib/python2.7/site-packages/libcloud/common/openstack.py", line 227, in request
raw=raw)
File "/usr/lib/python2.7/site-packages/libcloud/common/base.py", line 753, in request
action = self.morph_action_hook(action)
File "/usr/lib/python2.7/site-packages/libcloud/common/openstack.py", line 294, in morph_action_hook
self._populate_hosts_and_request_paths()
File "/usr/lib/python2.7/site-packages/libcloud/common/openstack.py", line 327, in _populate_hosts_and_request_paths
 osa = osa.authenticate(**kwargs)  # may throw InvalidCreds
File "/usr/lib/python2.7/site-packages/libcloud/common/openstack_identity.py", line 852, in authenticate
return self._authenticate_2_0_with_password()
File "/usr/lib/python2.7/site-packages/libcloud/common/openstack_identity.py", line 877, in        _authenticate_2_0_with_password
return self._authenticate_2_0_with_body(reqbody)
File "/usr/lib/python2.7/site-packages/libcloud/common/openstack_identity.py", line 882, in _authenticate_2_0_with_body
method='POST')
File "/usr/lib/python2.7/site-packages/libcloud/common/base.py", line 851, in request
raise ssl.SSLError(str(e))
ssl.SSLError: ('[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:765)',)

I am getting the output otherwise

 glance image-list
--------------------------------------+--------+
| ID                                   | Name   | 
+--------------------------------------+--------+
| 2badab24-0366-4097-8254-28dc3bf0eb9d | Cirros |
+--------------------------------------+--------+
edit retag flag offensive close merge delete