TypeError when trying to log-in in a DevStack deployment

Asked by Victoria Martinez de la Cruz

Hi guys!

I recently reinstalled my development environment and unfortunately I encountered I couldn't log in to the Dashboard.

According the trace, the exception is thrown by python-novaclient, but I couldn't figure out what's going on exactly.

Here is the mentioned trace,

####

Environment:

Request Method: GET
Request URL: http://127.0.0.1/admin/

Django Version: 1.4.3
Python Version: 2.7.3
Installed Applications:
['openstack_dashboard',
 'django.contrib.contenttypes',
 'django.contrib.auth',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.humanize',
 'compressor',
 'horizon',
 'openstack_dashboard.dashboards.project',
 'openstack_dashboard.dashboards.admin',
 'openstack_dashboard.dashboards.settings',
 'openstack_auth']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'horizon.middleware.HorizonMiddleware',
 'django.middleware.doc.XViewMiddleware',
 'django.middleware.locale.LocaleMiddleware')

Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
  111. response = callback(request, *callback_args, **callback_kwargs)
File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/decorators.py" in dec
  38. return view_func(request, *args, **kwargs)
File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/decorators.py" in dec
  86. return view_func(request, *args, **kwargs)
File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/decorators.py" in dec
  54. return view_func(request, *args, **kwargs)
File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/decorators.py" in dec
  38. return view_func(request, *args, **kwargs)
File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/decorators.py" in dec
  86. return view_func(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/views/generic/base.py" in view
  48. return self.dispatch(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/views/generic/base.py" in dispatch
  69. return handler(request, *args, **kwargs)
File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/tables/views.py" in get
  155. handled = self.construct_tables()
File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/tables/views.py" in construct_tables
  146. handled = self.handle_table(table)
File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/tables/views.py" in handle_table
  118. data = self._get_data_dict()
File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/tables/views.py" in _get_data_dict
  182. self._data = {self.table_class._meta.name: self.get_data()}
File "/opt/stack/horizon/openstack_dashboard/wsgi/../../openstack_dashboard/dashboards/admin/overview/views.py" in get_data
  38. data = super(GlobalOverview, self).get_data()
File "/opt/stack/horizon/openstack_dashboard/wsgi/../../openstack_dashboard/usage/views.py" in get_data
  33. self.usage.summarize(*self.usage.get_date_range())
File "/opt/stack/horizon/openstack_dashboard/wsgi/../../openstack_dashboard/usage/base.py" in summarize
  98. _('Unable to retrieve usage information.'))
File "/opt/stack/horizon/openstack_dashboard/wsgi/../../openstack_dashboard/usage/base.py" in summarize
  95. self.usage_list = self.get_usage_list(start, end)
File "/opt/stack/horizon/openstack_dashboard/wsgi/../../openstack_dashboard/usage/base.py" in get_usage_list
  130. return api.nova.usage_list(self.request, start, end)
File "/opt/stack/horizon/openstack_dashboard/wsgi/../../openstack_dashboard/api/nova.py" in usage_list
  463. novaclient(request).usage.list(start, end, True)]
File "/opt/stack/horizon/openstack_dashboard/wsgi/../../openstack_dashboard/api/nova.py" in novaclient
  261. http_log_debug=settings.DEBUG)
File "/opt/stack/python-novaclient/novaclient/v1_1/client.py" in __init__
  146. cacert=cacert)
File "/opt/stack/python-novaclient/novaclient/client.py" in __init__
  103. if hasattr(requests, logging):

Exception Type: TypeError at /admin/
Exception Value: hasattr(): attribute name must be string

####

It's a basic DevStack implementation, with Quantum and Swift enabled.

Screen logs looks fine, except from Horizon's one that shows the attached trace, and stack.sh log doesn't show anything weird either.

I'll keep digging to see if I can figure this out, but any help will be totally appreciated.

Revision history for this message
Sunil Bhatia (sunil-g) said :
#1

I am getting exactly same stack trace.
Googling did not help much.

Appears the problem may be with the devstack build.

Environment:
Ubuntu 12.04.1

DevStack downloaded from devstack.org

Revision history for this message
Best Chuan-Heng Hsiao (hsiao-chuanheng) said :
#2

in current version:
(commit 0db2ff24c6e7e9104fbe1edc867297a40642ffcb
 Merge: 320e2ff 2eeab72
 Author: Jenkins <email address hidden>
 Date: Mon Feb 11 20:25:52 2013 +0000
 Merge "Fix run_tests.sh --coverage")

I found that the problem will be gone
if we modify the code in /opt/stack/python-novaclient/novaclient
as ('<' is the current version, and '>' is the modified version)

103c103
< if hasattr(requests, logging):
---
> if hasattr(requests, 'logging'):

Revision history for this message
Victoria Martinez de la Cruz (vkmc) said :
#3

Thanks Chuan-Heng Hsiao, that solved my question.

Revision history for this message
Victoria Martinez de la Cruz (vkmc) said :
#4

It worked for admin, but demo user continues behaving abnormally.

When trying to log with demo user a 403 Forbidden error will rise.

I'll open a new question for that issue as it not fully related with this.

Revision history for this message
Sunil Bhatia (sunil-g) said :
#5

Still getting same error. You can see the stack trace that logging has been changed to string:
> 103. if hasattr(requests, 'logging'):

Environment:

Request Method: GET
Request URL: http://localhost:8888/admin/

Django Version: 1.4.3
Python Version: 2.7.3
Installed Applications:
['openstack_dashboard',
 'django.contrib.contenttypes',
 'django.contrib.auth',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.humanize',
 'compressor',
 'horizon',
 'openstack_dashboard.dashboards.project',
 'openstack_dashboard.dashboards.admin',
 'openstack_dashboard.dashboards.settings',
 'openstack_auth']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'horizon.middleware.HorizonMiddleware',
 'django.middleware.doc.XViewMiddleware',
 'django.middleware.locale.LocaleMiddleware')

Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
  111. response = callback(request, *callback_args, **callback_kwargs)
File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/decorators.py" in dec
  38. return view_func(request, *args, **kwargs)
File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/decorators.py" in dec
  86. return view_func(request, *args, **kwargs)
File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/decorators.py" in dec
  54. return view_func(request, *args, **kwargs)
File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/decorators.py" in dec
  38. return view_func(request, *args, **kwargs)
File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/decorators.py" in dec
  86. return view_func(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/views/generic/base.py" in view
  48. return self.dispatch(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/views/generic/base.py" in dispatch
  69. return handler(request, *args, **kwargs)
File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/tables/views.py" in get
  155. handled = self.construct_tables()
File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/tables/views.py" in construct_tables
  146. handled = self.handle_table(table)
File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/tables/views.py" in handle_table
  118. data = self._get_data_dict()
File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/tables/views.py" in _get_data_dict
  182. self._data = {self.table_class._meta.name: self.get_data()}
File "/opt/stack/horizon/openstack_dashboard/wsgi/../../openstack_dashboard/dashboards/admin/overview/views.py" in get_data
  38. data = super(GlobalOverview, self).get_data()
File "/opt/stack/horizon/openstack_dashboard/wsgi/../../openstack_dashboard/usage/views.py" in get_data
  33. self.usage.summarize(*self.usage.get_date_range())
File "/opt/stack/horizon/openstack_dashboard/wsgi/../../openstack_dashboard/usage/base.py" in summarize
  98. _('Unable to retrieve usage information.'))
File "/opt/stack/horizon/openstack_dashboard/wsgi/../../openstack_dashboard/usage/base.py" in summarize
  95. self.usage_list = self.get_usage_list(start, end)
File "/opt/stack/horizon/openstack_dashboard/wsgi/../../openstack_dashboard/usage/base.py" in get_usage_list
  130. return api.nova.usage_list(self.request, start, end)
File "/opt/stack/horizon/openstack_dashboard/wsgi/../../openstack_dashboard/api/nova.py" in usage_list
  463. novaclient(request).usage.list(start, end, True)]
File "/opt/stack/horizon/openstack_dashboard/wsgi/../../openstack_dashboard/api/nova.py" in novaclient
  261. http_log_debug=settings.DEBUG)
File "/opt/stack/python-novaclient/novaclient/v1_1/client.py" in __init__
  146. cacert=cacert)
File "/opt/stack/python-novaclient/novaclient/client.py" in __init__
  103. if hasattr(requests, 'logging'):

Exception Type: TypeError at /admin/
Exception Value: hasattr(): attribute name must be string

Revision history for this message
Chuan-Heng Hsiao (hsiao-chuanheng) said :
#6

I just created a bug-report to the devs.

The temporary solution here should be reported to the devs.
They will solve this issue soon.

Revision history for this message
Chuan-Heng Hsiao (hsiao-chuanheng) said :
#7

Sunil:

Maybe you need to do unstack.sh first, and then do stack.sh to restart the stack.

Revision history for this message
Sunil Bhatia (sunil-g) said :
#8

Thanks a ton, that did resolve the problem.

Just a curious question, is there a better way than unstack.sh,
I tried many scripts to stop and start the devstack but none worked.

Is there a clean way to restart the devstack.