Custom theme with templates/500.html file fails with " ValueError: need more than 1 value to unpack "

Bug #1703296 reported by Thomas Bechtold
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
In Progress
Medium
Thomas Bechtold

Bug Description

## This happens with Ocata (version 11.0.4.dev1), SLES12SP2, Django 1.8.14 ##

When using a custom theme with the following structure:

# find openstack_dashboard/themes/suse/
openstack_dashboard/themes/suse/
openstack_dashboard/themes/suse/templates
openstack_dashboard/themes/suse/templates/500.html
openstack_dashboard/themes/suse/_variables.scss
openstack_dashboard/themes/suse/img
openstack_dashboard/themes/suse/img/favicon.ico
openstack_dashboard/themes/suse/img/logo.png
openstack_dashboard/themes/suse/img/logo-splash.png
openstack_dashboard/themes/suse/_styles.scss

Running the migration fails with:

# su wwwrun -s /bin/sh -c "python manage.py migrate --fake-initial --noinput"
Traceback (most recent call last):
  File "manage.py", line 23, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
    utility.execute()
  File "/usr/lib/python2.7/site-packages/django/core/management/__init__.py", line 303, in execute
    settings.INSTALLED_APPS
  File "/usr/lib/python2.7/site-packages/django/conf/__init__.py", line 48, in __getattr__
    self._setup(name)
  File "/usr/lib/python2.7/site-packages/django/conf/__init__.py", line 44, in _setup
    self._wrapped = Settings(settings_module)
  File "/usr/lib/python2.7/site-packages/django/conf/__init__.py", line 92, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/srv/www/openstack-dashboard/openstack_dashboard/settings.py", line 428, in <module>
    THEME_COLLECTION_DIR, ROOT_PATH)
  File "/srv/www/openstack-dashboard/openstack_dashboard/utils/settings.py", line 330, in find_static_files
    (templates_part, override_path) = theme_file.split('/templates/')
ValueError: need more than 1 value to unpack

The reason is that file_discovery.populate_horizon_config(x, '/srv/www/openstack-dashboard/openstack_dashboard/themes/suse') populate the variable 'x' with:

{'external_templates': ['templates/500.html'], 'js_spec_files': [], 'js_files': []}

So the 'external_templates' list entries do not start with '/templates/'. So the split of that will fail.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.openstack.org/482012

Changed in horizon:
assignee: nobody → Thomas Bechtold (toabctl)
status: New → In Progress
Changed in horizon:
importance: Undecided → Medium
Revision history for this message
Ondrej Vasko (ondrej.vasko) wrote :

This also happens when I overrided `_login_footer.html` and then run `manage.py collectstatic`.

I printed variable `theme_file` and the result is `templates/_login_footer.html`, so the split is failing.

Happened on Horizon stable/ocata and also stable/pike

Revision history for this message
Akihiro Motoki (amotoki) wrote :

Is bug 1744239 a same problem? The fix handles a template like templates/_login_footer.html.
bug 1744239 was filed later but the fix has been merged and was backported to several stable branches.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on horizon (master)

Change abandoned by Akihiro Motoki (<email address hidden>) on branch: master
Review: https://review.openstack.org/482012
Reason: The bug was fixed in another change. This is no longer needed.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.