Comment 3 for bug 1546280

Revision history for this message
steweddude (brian-toy) wrote : RE: [Bug 1546280] Re: cinderclient having a problem with keystone v3

Try this. And you'll note I'm using a cert.

from keystoneclient.auth.identity import v3
from keystoneclient import session
from keystoneclient.v3 import client
from keystoneauth1 import loading
from keystoneauth1 import session as nvsession

   def __init__(self):

    # Create and config the Keystone client
        auth = v3.Password(
                       auth_url=keystone_url,
                       password=pass,
                       username=id,
                       user_domain_name='Users',
                       domain_name='Users'
                       )
        self.sess = session.Session(auth=auth, verify=self.cert)
        self.ksclient = client.Client(session=self.sess)

-----Original Message-----
From: <email address hidden> [mailto:<email address hidden>] On Behalf Of Dilip Sunkum Manjunath
Sent: Tuesday, November 15, 2016 5:11 AM
To: Toy, Brian - NITC, Kansas City, MO <email address hidden>
Subject: [Bug 1546280] Re: cinderclient having a problem with keystone v3

any one has a workaround for this?

--
You received this bug notification because you are subscribed to the bug report.
https://bugs.launchpad.net/bugs/1546280

Title:
  cinderclient having a problem with keystone v3

Status in python-cinderclient:
  Confirmed

Bug description:
  Don't know if this is a bug or not......but cinderclient seems to be
  assuming the all keystone auth is v2. Here's the code I'm using:

          cinder = client.Client('2','S_Atmos-ReadAccess','password',
                                 auth_url='https://10.210.21.12:5000/v3',
                                 cacert='/home/btoy/atmos_cert2.pem',projectid='85bd78a2a77145a2a6d6a68cb3162e41'
                                 )
          i = cinder.volumes.list()

  Here's the tcp conversation, note the POST:

  POST /v3/v2.0/tokens HTTP/1.1

  Host: 10.210.23.12:5000

  Content-Length: 100

  Accept-Encoding: gzip, deflate

  Accept: application/json

  User-Agent: python-cinderclient

  Connection: keep-alive

  Content-Type: application/json

  {"auth": {"passwordCredentials": {"username": "S_Atmos-ReadAccess",
  "password": "password"}}}HTTP/1.1 404 Not Found

  Date: Tue, 16 Feb 2016 19:41:02 GMT

  Server: Apache

  Vary: X-Auth-Token

  x-openstack-request-id: req-7db54ec5-0488-4f5f-aa35-8ea3655dfc42

  Content-Length: 93

  Connection: close

  Content-Type: application/json

  {"error": {"message": "The resource could not be found.", "code": 404,
  "title": "Not Found"}}

  Here's the command line output:

  Traceback (most recent call last):
    File "sessionTest.py", line 40, in <module>
      sys.exit(main())
    File "sessionTest.py", line 27, in main
      i = cinder.volumes.list()
    File "/home/btoy/PycharmProjects/OpenstackQuotaSync/cinderclient/v2/volumes.py", line 294, in list
      return self._list(url, resource_type, limit=limit)
    File "/home/btoy/PycharmProjects/OpenstackQuotaSync/cinderclient/base.py", line 73, in _list
      resp, body = self.api.client.get(url)
    File "/home/btoy/PycharmProjects/OpenstackQuotaSync/cinderclient/client.py", line 318, in get
      return self._cs_request(url, 'GET', **kwargs)
    File "/home/btoy/PycharmProjects/OpenstackQuotaSync/cinderclient/client.py", line 275, in _cs_request
      self.authenticate()
    File "/home/btoy/PycharmProjects/OpenstackQuotaSync/cinderclient/client.py", line 454, in authenticate
      self._v2_auth(auth_url)
    File "/home/btoy/PycharmProjects/OpenstackQuotaSync/cinderclient/client.py", line 498, in _v2_auth
      self._authenticate(url, body)
    File "/home/btoy/PycharmProjects/OpenstackQuotaSync/cinderclient/client.py", line 509, in _authenticate
      allow_redirects=True)
    File "/home/btoy/PycharmProjects/OpenstackQuotaSync/cinderclient/client.py", line 264, in request
      raise exceptions.from_response(resp, body)
  cinderclient.exceptions.NotFound: The resource could not be found. (HTTP 404)

To manage notifications about this bug go to:
https://bugs.launchpad.net/python-cinderclient/+bug/1546280/+subscriptions

This electronic message contains information generated by the USDA solely for the intended recipients. Any unauthorized interception of this message or the use or disclosure of the information it contains may violate the law and subject the violator to civil or criminal penalties. If you believe you have received this message in error, please notify the sender and delete the email immediately.