Advertisement
Guest User

Untitled

a guest
Jul 2nd, 2015
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.89 KB | None | 0 0
  1. #!env python
  2.  
  3. from libcloud.compute.types import Provider
  4. from libcloud.compute.providers import get_driver
  5.  
  6. auth_username = 'admin'
  7. auth_password = '7dffe25b58af7949ee10'
  8. auth_url = 'http://10.1.10.125:5000/'
  9.  
  10. provider = get_driver(Provider.OPENSTACK)
  11. conn = provider(auth_username,
  12. auth_password,
  13. secure=False,
  14. ex_force_auth_url=auth_url,
  15. ex_force_auth_version="2.0_password")
  16.  
  17. images = conn.list_images()
  18. for image in images:
  19. print(image)
  20.  
  21.  
  22.  
  23. ----
  24.  
  25. Traceback (most recent call last):
  26. File "./test.py", line 17, in <module>
  27. images = conn.list_images()
  28. File "/home/dkerschner/tmp/os/local/lib/python2.7/site-packages/libcloud/compute/drivers/openstack.py", line 226, in list_images
  29. self.connection.request('/images/detail').object, ex_only_active)
  30. File "/home/dkerschner/tmp/os/local/lib/python2.7/site-packages/libcloud/common/openstack.py", line 200, in request
  31. raw=raw)
  32. File "/home/dkerschner/tmp/os/local/lib/python2.7/site-packages/libcloud/common/base.py", line 657, in request
  33. action = self.morph_action_hook(action)
  34. File "/home/dkerschner/tmp/os/local/lib/python2.7/site-packages/libcloud/common/openstack.py", line 255, in morph_action_hook
  35. self._populate_hosts_and_request_paths()
  36. File "/home/dkerschner/tmp/os/local/lib/python2.7/site-packages/libcloud/common/openstack.py", line 288, in _populate_hosts_and_request_paths
  37. osa = osa.authenticate(**kwargs) # may throw InvalidCreds
  38. File "/home/dkerschner/tmp/os/local/lib/python2.7/site-packages/libcloud/common/openstack_identity.py", line 841, in authenticate
  39. return self._authenticate_2_0_with_password()
  40. File "/home/dkerschner/tmp/os/local/lib/python2.7/site-packages/libcloud/common/openstack_identity.py", line 866, in _authenticate_2_0_with_password
  41. return self._authenticate_2_0_with_body(reqbody)
  42. File "/home/dkerschner/tmp/os/local/lib/python2.7/site-packages/libcloud/common/openstack_identity.py", line 879, in _authenticate_2_0_with_body
  43. driver=self.driver)
  44. libcloud.common.types.MalformedResponseError: <MalformedResponseException in <libcloud.compute.drivers.openstack.OpenStack_1_1_NodeDriver object at 0x7f3ee3b96b10> 'Malformed response'>: 'code: 300 body: {"versions": {"values": [{"status": "stable", "updated": "2015-03-30T00:00:00Z", "media-types": [{"base": "application/json", "type": "application/vnd.openstack.identity-v3+json"}], "id": "v3.4", "links": [{"href": "http://10.1.10.125:5000/v3/", "rel": "self"}]}, {"status": "stable", "updated": "2014-04-17T00:00:00Z", "media-types": [{"base": "application/json", "type": "application/vnd.openstack.identity-v2.0+json"}], "id": "v2.0", "links": [{"href": "http://10.1.10.125:5000/v2.0/", "rel": "self"}, {"href": "http://docs.openstack.org/", "type": "text/html", "rel": "describedby"}]}]}}'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement