urlsplit error during novaclient authentication

asked 2015-02-05 14:45:26 -0500

Sammitch gravatar image

So I've got some OpenStack gear and I'm sick of fighting with the dashboard, so I'd like to write my own bit of automation in python. However, I've barely even gotten my feet wet and I'm running into problems.

Code:

from keystoneclient.auth.identity import v2
from keystoneclient import session
from novaclient.client import Client

auth = v2.Password(auth_url='http://10.0.0.1:5000/v2.0/', username='foo.bla-admin',
    password='hunter2', tenant_name='foo.bla')
sess = session.Session(auth=auth)
nova = Client(2, sess)

print nova.authenticate()

Error:

Traceback (most recent call last):
  File "test.py", line 13, in <module>
    print nova.authenticate()
  File "/usr/lib/python2.6/site-packages/novaclient/client.py", line 169, in wrapper
    return f(self, *args, **kwargs)
  File "/usr/lib/python2.6/site-packages/novaclient/v1_1/client.py", line 239, in authenticate
    self.client.authenticate()
  File "/usr/lib/python2.6/site-packages/novaclient/client.py", line 561, in authenticate
    magic_tuple = netutils.urlsplit(self.auth_url)
  File "/usr/lib/python2.6/site-packages/oslo_utils/netutils.py", line 228, in urlsplit
    url, scheme, allow_fragments)
  File "/usr/lib64/python2.6/urlparse.py", line 171, in urlsplit
    i = url.find(':')
AttributeError: 'NoneType' object has no attribute 'find'

All of the connection info has come from the environment variables on the controller, so I know that that should be correct, and I've tried swapping the tenant name with the project ID but still no joy. I have no idea why it's throwing this error all the way down in urlparse, or why it appears to be using the 1.1 client even though I've specified v2.

Also, I get the same error whether or not I use keystone auth, I figured it was my best bet since OS_AUTH_STRATEGY=keystone in the controller's rc file.

Lastly, in case it's helpful, during the imports I also get the following deprecation warnings:

/usr/lib/python2.6/site-packages/keystoneclient/access.py:20: DeprecationWarning: The oslo namespace package is deprecated. Please use oslo_utils instead.
  from oslo.utils import timeutils
/usr/lib/python2.6/site-packages/keystoneclient/i18n.py:21: DeprecationWarning: The oslo namespace package is deprecated. Please use oslo_i18n instead.
  from oslo import i18n
/usr/lib/python2.6/site-packages/keystoneclient/session.py:20: DeprecationWarning: The oslo namespace package is deprecated. Please use oslo_config instead.
  from oslo.config import cfg
/usr/lib/python2.6/site-packages/keystoneclient/session.py:21: DeprecationWarning: The oslo namespace package is deprecated. Please use oslo_serialization instead.
  from oslo.serialization import jsonutils
edit retag flag offensive close merge delete