horizon plugin gives the KeyError

Bug #1603307 reported by zhurong
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Murano
Invalid
High
Timur Sufiev
OpenStack Dashboard (Horizon)
Fix Released
High
Timur Sufiev

Bug Description

horizon master with murano-dashboard, open the murano-dashboard, give the error:
  File "/opt/openstack/horizon/.tox/venv/lib/python2.7/site-packages/django/dispatch/dispatcher.py", line 189, in send
    response = receiver(signal=self, sender=sender, **named)
  File "/opt/openstack/horizon/horizon/templatetags/angular.py", line 36, in update_angular_template_hash
    theme = context['THEME'] # current theme being compressed
KeyError: 'THEME'

zhurong (zhu-rong)
Changed in horizon:
assignee: nobody → zhurong (zhu-rong)
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/342619

Changed in horizon:
status: New → In Progress
Revision history for this message
zhurong (zhu-rong) wrote :
Revision history for this message
zhurong (zhu-rong) wrote :

instance index template changed as follows:
diff --git a/openstack_dashboard/dashboards/project/instances/templates/instances/index.html b/openstack_dashboard/dashboards/project/instances/templates/instances/index.html
index bec1e9b..64ce110 100644
--- a/openstack_dashboard/dashboards/project/instances/templates/instances/index.html
+++ b/openstack_dashboard/dashboards/project/instances/templates/instances/index.html
@@ -1,7 +1,15 @@
 {% extends 'base.html' %}
 {% load i18n %}
+{% load compress %}
 {% block title %}{% trans "Instances" %}{% endblock %}

 {% block main %}
   {{ table.render }}
 {% endblock %}
+
+{% block css %}
+ {{ block.super }}
+ {% compress css %}
+ <link href='{{ STATIC_URL }}horizon/lib/rickshaw.css' type='text/css' media='screen' rel='stylesheet' />
+ {% endcompress %}
+{% endblock %}

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Changed in horizon:
assignee: zhurong (zhu-rong) → Rob Cresswell (robcresswell)
zhurong (zhu-rong)
affects: horizon → murano
affects: murano → horizon
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to murano-dashboard (master)

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

Changed in murano:
assignee: nobody → zhurong (zhu-rong)
status: New → In Progress
Changed in murano:
importance: Undecided → High
milestone: none → newton-3
Revision history for this message
Timur Sufiev (tsufiev-x) wrote :
Download full text (5.7 KiB)

More to this issue: if you run openstack_dashboard py27dj19 tests, a lot of tests (or all of them?) produce this kind of noise:

Traceback (most recent call last):
  File "/home/tsufiev/develop/horizon/.venv/local/lib/python2.7/site-packages/django/template/loader_tags.py", line 209, in render
    return template.render(context)
  File "/home/tsufiev/develop/horizon/.venv/local/lib/python2.7/site-packages/django/template/base.py", line 208, in render
    return self._render(context)
  File "/home/tsufiev/develop/horizon/.venv/local/lib/python2.7/site-packages/django/test/utils.py", line 92, in instrumented_test_render
    return self.nodelist.render(context)
  File "/home/tsufiev/develop/horizon/.venv/local/lib/python2.7/site-packages/django/template/base.py", line 988, in render
    bit = node.render_annotated(context)
  File "/home/tsufiev/develop/horizon/.venv/local/lib/python2.7/site-packages/django/template/base.py", line 955, in render_annotated
    return self.render(context)
  File "/home/tsufiev/develop/horizon/.venv/local/lib/python2.7/site-packages/compressor/templatetags/compress.py", line 127, in render
    return self.render_compressed(context, self.kind, self.mode, forced=forced)
  File "/home/tsufiev/develop/horizon/.venv/local/lib/python2.7/site-packages/compressor/templatetags/compress.py", line 103, in render_compressed
    rendered_output = compressor.output(mode, forced=forced)
  File "/home/tsufiev/develop/horizon/.venv/local/lib/python2.7/site-packages/compressor/css.py", line 49, in output
    ret.append(subnode.output(*args, **kwargs))
  File "/home/tsufiev/develop/horizon/.venv/local/lib/python2.7/site-packages/compressor/css.py", line 51, in output
    return super(CssCompressor, self).output(*args, **kwargs)
  File "/home/tsufiev/develop/horizon/.venv/local/lib/python2.7/site-packages/compressor/base.py", line 299, in output
    return self.handle_output(mode, filtered_output, forced)
  File "/home/tsufiev/develop/horizon/.venv/local/lib/python2.7/site-packages/compressor/base.py", line 307, in handle_output
    return output_func(mode, content, forced, basename)
  File "/home/tsufiev/develop/horizon/.venv/local/lib/python2.7/site-packages/compressor/base.py", line 321, in output_file
    return self.render_output(mode, {"url": url})
  File "/home/tsufiev/develop/horizon/.venv/local/lib/python2.7/site-packages/compressor/base.py", line 350, in render_output
    mode=mode, context=final_context)
  File "/home/tsufiev/develop/horizon/.venv/local/lib/python2.7/site-packages/django/dispatch/dispatcher.py", line 192, in send
    response = receiver(signal=self, sender=sender, **named)
  File "/home/tsufiev/develop/horizon/horizon/templatetags/angular.py", line 36, in update_angular_template_hash
    theme = context['THEME'] # current theme being compressed
KeyError: 'THEME'
WARNING:django.template:Exception raised while rendering {% include %} for template 'admin/flavors/create.html'. Empty string rendered instead.
Traceback (most recent call last):
  File "/home/tsufiev/develop/horizon/.venv/local/lib/python2.7/site-packages/django/template/loader_tags.py", line 209, in render
    return template.render(context)
  Fil...

Read more...

Changed in horizon:
assignee: Rob Cresswell (robcresswell) → David Lyle (david-lyle)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/344871
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=126860671c082d032102a720832e5f8cfefa537a
Submitter: Jenkins
Branch: master

commit 126860671c082d032102a720832e5f8cfefa537a
Author: Rob Cresswell <email address hidden>
Date: Wed Jul 20 15:41:18 2016 +0100

    Fix missing 'THEME' key

    Change-Id: If1a296c3c9bb1fd7de2effa107d898a482754ed8
    Closes-bug: 1603307

Changed in horizon:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on horizon (master)

Change abandoned by zhurong (<email address hidden>) on branch: master
Review: https://review.openstack.org/342619

Changed in horizon:
milestone: none → newton-3
importance: Undecided → Low
Changed in murano:
assignee: zhurong (zhu-rong) → Kirill Zaitsev (kzaitsev)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to murano-dashboard (master)

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

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

Change abandoned by Kirill Zaitsev (<email address hidden>) on branch: master
Review: https://review.openstack.org/345812
Reason: in favor of https://review.openstack.org/#/c/358778/1

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

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

Changed in murano:
assignee: Kirill Zaitsev (kzaitsev) → Timur Sufiev (tsufiev-x)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on murano-dashboard (master)

Change abandoned by Kirill Zaitsev (<email address hidden>) on branch: master
Review: https://review.openstack.org/358778

Changed in murano:
assignee: Timur Sufiev (tsufiev-x) → Kirill Zaitsev (kzaitsev)
Changed in murano:
assignee: Kirill Zaitsev (kzaitsev) → Timur Sufiev (tsufiev-x)
Changed in murano:
status: In Progress → Confirmed
Revision history for this message
Timur Sufiev (tsufiev-x) wrote :
Changed in murano:
status: Confirmed → In Progress
Changed in horizon:
assignee: David Lyle (david-lyle) → Timur Sufiev (tsufiev-x)
status: Fix Released → In Progress
milestone: newton-3 → newton-rc1
importance: Low → High
Changed in murano:
status: In Progress → Invalid
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/horizon 10.0.0.0b3

This issue was fixed in the openstack/horizon 10.0.0.0b3 development milestone.

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

Reviewed: https://review.openstack.org/359850
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=9445d15cd133becf0137350ba843526d4548d4d0
Submitter: Jenkins
Branch: master

commit 9445d15cd133becf0137350ba843526d4548d4d0
Author: Timur Sufiev <email address hidden>
Date: Wed Aug 24 15:46:43 2016 +0300

    Fix various issues with compressed angular templates and plugins

    First, retrieve current theme only in cases when it already has been
    provided in the context. That should prevent missing 'THEME' errors
    when post_compress signal is being processed, for example inside
    _stylesheets.html which does not provide THEME var into the rendering
    context.

    Second, under certain circumstances, offline compression was producing
    a different hash for compressed angular templates than runtime
    template renderer was expecting. Make the combined template with all
    angular templates be a deterministic - convert it from a dictionary to
    a list of key-value tuples. Various order of dictionary entries in
    offline and online compress phases seemed to produce 'missing compress
    hash key' error.

    Closed-Bug: #1603307
    Change-Id: Idb48c3f68da43bba33033a71e6d69bdc112736de

Changed in horizon:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on murano-dashboard (master)

Change abandoned by Timur Sufiev (<email address hidden>) on branch: master
Review: https://review.openstack.org/343252

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Change abandoned by Timur Sufiev (<email address hidden>) on branch: master
Review: https://review.openstack.org/359276

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

Other bug subscribers

Bug attachments

Remote bug watches

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