visit horizon failure because of import module failure
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Dashboard (Horizon) |
Fix Released
|
Medium
|
Richard Jones | ||
OpenStack-Ansible |
Fix Released
|
High
|
Donovan Francesco | ||
osprofiler |
Fix Released
|
Critical
|
Unassigned | ||
python-mistralclient |
Fix Released
|
Undecided
|
Dina Belova | ||
tripleo |
Fix Released
|
High
|
James Slagle |
Bug Description
1. Use TripleO to deploy both undercloud, and overcloud, and enable horizon when building images.
2. Visit horizon portal always failure, and has below errors in horizon_error.log
[Wed Aug 20 01:45:58.441221 2014] [:error] [pid 5035:tid 3038755648] [remote 10.74.104.27:54198] mod_wsgi (pid=5035): Exception occurred processing WSGI script '/opt/stack/
[Wed Aug 20 01:45:58.441273 2014] [:error] [pid 5035:tid 3038755648] [remote 10.74.104.27:54198] Traceback (most recent call last):
[Wed Aug 20 01:45:58.441294 2014] [:error] [pid 5035:tid 3038755648] [remote 10.74.104.27:54198] File "/opt/stack/
[Wed Aug 20 01:45:58.449979 2014] [:error] [pid 5035:tid 3038755648] [remote 10.74.104.27:54198] self.load_
[Wed Aug 20 01:45:58.450000 2014] [:error] [pid 5035:tid 3038755648] [remote 10.74.104.27:54198] File "/opt/stack/
[Wed Aug 20 01:45:58.450556 2014] [:error] [pid 5035:tid 3038755648] [remote 10.74.104.27:54198] for middleware_path in settings.
[Wed Aug 20 01:45:58.450576 2014] [:error] [pid 5035:tid 3038755648] [remote 10.74.104.27:54198] File "/opt/stack/
[Wed Aug 20 01:45:58.454248 2014] [:error] [pid 5035:tid 3038755648] [remote 10.74.104.27:54198] self._setup(name)
[Wed Aug 20 01:45:58.454269 2014] [:error] [pid 5035:tid 3038755648] [remote 10.74.104.27:54198] File "/opt/stack/
[Wed Aug 20 01:45:58.454305 2014] [:error] [pid 5035:tid 3038755648] [remote 10.74.104.27:54198] self._wrapped = Settings(
[Wed Aug 20 01:45:58.454319 2014] [:error] [pid 5035:tid 3038755648] [remote 10.74.104.27:54198] File "/opt/stack/
__.py", line 128, in __init__
[Wed Aug 20 01:45:58.454338 2014] [:error] [pid 5035:tid 3038755648] [remote 10.74.104.27:54198] mod = importlib.
[Wed Aug 20 01:45:58.454350 2014] [:error] [pid 5035:tid 3038755648] [remote 10.74.104.27:54198] File "/opt/stack/
[Wed Aug 20 01:45:58.462806 2014] [:error] [pid 5035:tid 3038755648] [remote 10.74.104.27:54198] __import__(name)
[Wed Aug 20 01:45:58.462826 2014] [:error] [pid 5035:tid 3038755648] [remote 10.74.104.27:54198] File "/opt/stack/
[Wed Aug 20 01:45:58.467136 2014] [:error] [pid 5035:tid 3038755648] [remote 10.74.104.27:54198] from openstack_dashboard import exceptions
[Wed Aug 20 01:45:58.467156 2014] [:error] [pid 5035:tid 3038755648] [remote 10.74.104.27:54198] File "/opt/stack/
[Wed Aug 20 01:45:58.467667 2014] [:error] [pid 5035:tid 3038755648] [remote 10.74.104.27:54198] from keystoneclient import exceptions as keystoneclient
[Wed Aug 20 01:45:58.467685 2014] [:error] [pid 5035:tid 3038755648] [remote 10.74.104.27:54198] File "/opt/stack/
[Wed Aug 20 01:45:58.472968 2014] [:error] [pid 5035:tid 3038755648] [remote 10.74.104.27:54198] from keystoneclient import client
[Wed Aug 20 01:45:58.472989 2014] [:error] [pid 5035:tid 3038755648] [remote 10.74.104.27:54198] File "/opt/stack/
[Wed Aug 20 01:45:58.473833 2014] [:error] [pid 5035:tid 3038755648] [remote 10.74.104.27:54198] from keystoneclient import discover
[Wed Aug 20 01:45:58.473851 2014] [:error] [pid 5035:tid 3038755648] [remote 10.74.104.27:54198] File "/opt/stack/
[Wed Aug 20 01:45:58.474163 2014] [:error] [pid 5035:tid 3038755648] [remote 10.74.104.27:54198] from keystoneclient import session as client_session
[Wed Aug 20 01:45:58.474182 2014] [:error] [pid 5035:tid 3038755648] [remote 10.74.104.27:54198] File "/opt/stack/
[Wed Aug 20 01:45:58.482131 2014] [:error] [pid 5035:tid 3038755648] [remote 10.74.104.27:54198] osprofiler_web = importutils.
[Wed Aug 20 01:45:58.482152 2014] [:error] [pid 5035:tid 3038755648] [remote 10.74.104.27:54198] File "/opt/stack/
[Wed Aug 20 01:45:58.482434 2014] [:error] [pid 5035:tid 3038755648] [remote 10.74.104.27:54198] return import_
[Wed Aug 20 01:45:58.482452 2014] [:error] [pid 5035:tid 3038755648] [remote 10.74.104.27:54198] File "/opt/stack/
[Wed Aug 20 01:45:58.482475 2014] [:error] [pid 5035:tid 3038755648] [remote 10.74.104.27:54198] __import_
[Wed Aug 20 01:45:58.482495 2014] [:error] [pid 5035:tid 3038755648] [remote 10.74.104.27:54198] File "/opt/stack/
[Wed Aug 20 01:45:58.487936 2014] [:error] [pid 5035:tid 3038755648] [remote 10.74.104.27:54198] utils.import_
[Wed Aug 20 01:45:58.487956 2014] [:error] [pid 5035:tid 3038755648] [remote 10.74.104.27:54198] File "/opt/stack/
[Wed Aug 20 01:45:58.488588 2014] [:error] [pid 5035:tid 3038755648] [remote 10.74.104.27:54198] __import_
[Wed Aug 20 01:45:58.488615 2014] [:error] [pid 5035:tid 3038755648] [remote 10.74.104.27:54198] ValueError: Empty module name
3. After troubleshooting, seems like function import_
In this case, below line will always create new_package = ... osprofiler, then cause the error.
new_package = ".".join(
One possible solution is to find the first "...." from right to left, then use that as module_name.
Changed in osprofiler: | |
importance: | Undecided → Critical |
status: | New → In Progress |
Changed in tripleo: | |
importance: | Critical → High |
Changed in tripleo: | |
status: | In Progress → Fix Released |
Changed in python-mistralclient: | |
status: | New → Fix Released |
Changed in horizon: | |
status: | New → Triaged |
importance: | Undecided → Medium |
milestone: | none → ocata-1 |
Changed in openstack-ansible: | |
status: | New → In Progress |
assignee: | nobody → Donovan Francesco (donovan-francesco) |
importance: | Undecided → High |
Changed in openstack-ansible: | |
status: | In Progress → Fix Released |
Changed in horizon: | |
status: | In Progress → Fix Released |
i've done some looking into this as well. As correctly indentified, the issue is with the import_ modules_ from_package function in osprofiler._utils.
The main difference between how TripleO configures horizon and how devstack configures horizon is that in TripleO, horizon is installed in a python virtualenv along with it's dependencies. The following line in the django.wsgi file for Horizon adds a relative path to sys.path:
sys.path.insert(0, os.path. join(os. path.dirname( os.path. realpath( __file_ _)), '../..'))
osprofiler ends up getting imported from the venv using that relative path (with a "../..") in it, and thus triggering this bug.