openstack team mailing list archive
-
openstack team
-
Mailing list archive
-
Message #04088
Re: novaclient+keystone problem AttributeError: 'unicode' object has no attribute 'items'
Alle mercoledì 14 settembre 2011, Sandy Walsh ha scritto:
> Heh, seems we're both running in the same direction.
>
> If you're using Keystone with Nova, you also have to use Keystone with
> Glance (assuming you're using Glance).
>
> Is this the case?
>
> -S
>
> ________________________________________
> From: openstack-bounces+sandy.walsh=rackspace.com@xxxxxxxxxxxxxxxxxxx
> [openstack-bounces+sandy.walsh=rackspace.com@xxxxxxxxxxxxxxxxxxx] on behalf
> of Carlo Impagliazzo [truijllo@xxxxxxx] Sent: Wednesday, September 14, 2011
> 11:46 AM
> To: openstack@xxxxxxxxxxxxxxxxxxx
> Subject: Re: [Openstack] novaclient+keystone problem AttributeError:
> 'unicode' object has no attribute 'items'
>
> Alle mercoledì 14 settembre 2011, Carlo Impagliazzo ha scritto:
> > Alle mercoledì 14 settembre 2011, Roman Sokolkov ha scritto:
> > > Hi! I have problem. I use keystone from trunk, python-novaclient 2.6.4
> > >
> > > # nova --debug list
> > > connect: (127.0.0.1, 5000)
> > > send: 'POST /v2.0/tokens HTTP/1.1\r\nHost:
> > > 127.0.0.1:5000\r\nContent-Length: 88\r\ncontent-type:
> > > application/json\r\naccept-encoding: gzip,
> > > deflate\r\nuser-agent: python-novaclient\r\n\r\n{"passwordCredentials":
> > > {"username": "admin", "password": "xxx", "tenantId": "1234"}}'
> > > reply: 'HTTP/1.1 200 OK\r\n'
> > > header: Content-Type: application/json; charset=UTF-8
> > > header: Content-Length: 1236
> > > header: Date: Wed, 14 Sep 2011 13:18:45 GMT
> > > Traceback (most recent call last):
> > > File "/usr/bin/nova", line 9, in <module>
> > > load_entry_point('python-novaclient==2.6.4', 'console_scripts',
> > > 'nova')()
> > > File "/usr/lib/python2.7/site-packages/novaclient/shell.py", line
> > > 219, in main
> > > OpenStackComputeShell().main(sys.argv[1:])
> > > File "/usr/lib/python2.7/site-packages/novaclient/shell.py", line
> > > 176, in main
> > > self.cs.authenticate()
> > > File "/usr/lib/python2.7/site-packages/novaclient/v1_0/client.py",
> > > line 57, in authenticate
> > > self.client.authenticate()
> > > File "/usr/lib/python2.7/site-packages/novaclient/client.py", line
> > > 144, in authenticate
> > > auth_url = self._v2_auth(auth_url)
> > > File "/usr/lib/python2.7/site-packages/novaclient/client.py", line
> > > 189, in _v2_auth
> > > service_catalog.ServiceCatalog(body)
> > > File
> > > "/usr/lib/python2.7/site-packages/novaclient/service_catalog.py", line
> > > 90, in __init__
> > > super(ServiceCatalog, self).__init__(resource)
> > > File
> > > "/usr/lib/python2.7/site-packages/novaclient/service_catalog.py", line
> > > 45, in __init__
> > > attribute = [res(x) for x in val]
> > > File
> > > "/usr/lib/python2.7/site-packages/novaclient/service_catalog.py", line
> > > 41, in __init__
> > > for res_key, res_value in value.items():
> > > AttributeError: 'unicode' object has no attribute 'items'
> >
> > I have the same problem, I've tried to fix it but it's a little difficult
> > understand the logic behind the management of the data structure.
> >
> > having a structure like the linked one it happens a kinky comparison:
> >
> > 'nova' in { 'publicURL': u'http://nova.publicinternets.com/v1.1/1234' }
> >
> > and then...it dumps because
> > value is 'http://nova.publicinternets.com/v1.1/1234' ( and so...like a
> > string obj it hasn't an items method )
> >
> >
> > Is the comparison logically right? isn't it too weak ?
> >
> >
> > This is the link with datastructure :
> > http://paste.openstack.org/show/2442/
> >
> > Carlo
> >
> >
> >
> >
> > _______________________________________________
> > Mailing list: https://launchpad.net/~openstack
> > Post to : openstack@xxxxxxxxxxxxxxxxxxx
> > Unsubscribe : https://launchpad.net/~openstack
> > More help : https://help.launchpad.net/ListHelp
>
> the patch suggested by Sandy works like a charm, it remains the question
> about the strange comparison :-/
>
>
> Now I have another problem,
>
> using a python script like this:
> NOVA_PROJECT_ID=1234
> NOVA_USERNAME="joeuser"
> NOVA_URL='http://192.168.0.100:5000/v2.0/'
> NOVA_API_KEY='fdf50e55-8f02-4aac-ac02-0adcb088325d'
> from novaclient.v1_1 import client
> nt = client.Client(NOVA_USERNAME, 'secrete', NOVA_PROJECT_ID, NOVA_URL)
>
>
> with this statement I obtain:
>
> nt.images.list()
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
>
> File
> "/usr/lib/python2.6/site-packages/python_novaclient-2.6.4-py2.6.egg/novacli
>ent/v1_1/images.py", line 45, in list
> return self._list("/images/detail", "images")
>
> File
> "/usr/lib/python2.6/site-packages/python_novaclient-2.6.4-py2.6.egg/novacli
>ent/base.py", line 66, in _list
> resp, body = self.api.client.get(url)
>
> File
> "/usr/lib/python2.6/site-packages/python_novaclient-2.6.4-py2.6.egg/novacli
>ent/client.py", line 126, in get
> return self._cs_request(url, 'GET', **kwargs)
>
> File
> "/usr/lib/python2.6/site-packages/python_novaclient-2.6.4-py2.6.egg/novacli
>ent/client.py", line 113, in _cs_request
> **kwargs)
>
> File
> "/usr/lib/python2.6/site-packages/python_novaclient-2.6.4-py2.6.egg/novacli
>ent/client.py", line 96, in request
> raise exceptions.from_response(resp, body)
> novaclient.exceptions.BadRequest: n/a (HTTP 400
>
> Any suggestions?
> Carlo
>
>
Hi Sandy
Yes and No.
Yes, I'm using glace with keystone
No, any changes don't work :)
In keystone and glance logs there are no trace about errors or forbidden
access when I'm having novaclient.exceptions.BadRequest
any suggestions ?
C.
References