django.template VariableDoesNotExist error when enabling DEBUG logging

Bug #1720893 reported by Feilong Wang
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Medium
Ivan Kolodyazhny

Bug Description

When enabling the DEBUG level for "console" handler in local_settings.py, you can see a lot below errors.

DEBUG 2017-10-02 21:06:11,615 django.template Exception while resolving variable 'is_small' in template 'horizon/common/_data_table_row_actions_dropdown.html'.
Traceback (most recent call last):
  File "/home/feilong/MyWorkspace/workspace_catalyst/openstack-horizon/pike/local/lib/python2.7/site-packages/django/template/base.py", line 903, in _resolve_lookup
    (bit, current)) # missing attribute
VariableDoesNotExist: Failed lookup for key [is_small] in u'[{\'False\': False, \'None\': None, \'True\': True}, {\'x_trace_info\': \'{"X-Trace-HMAC": "79db818611c206ee6b8aacdf9cb6eecc1bcd5233", "X-Trace-Info": "eyJwYXJlbnRfaWQiOiAiYWM0OGIyYzgtOGZiOC00N2FjLTkyOTEtZTMxY2U5MmRlZDhlIiwgImJhc2VfaWQiOiAiYzdiNzUzMmQtOGY4OS00ZTlhLThmM2MtNTQzNTdlMGJjZTRlIiwgImhtYWNfa2V5IjogIlNFQ1JFVF9LRVkifQ=="}\', u\'csrf_token\': <SimpleLazyObject: <function _get_val at 0x7f3ef8e727d0>>, \'False\': False, u\'request\': <WSGIRequest: GET \'/project/instances/\'>, \'profiler_enabled\': True, \'JS_CATALOG\': \'horizon+openstack_dashboard+adjutant_ui.dashboards.management+distil_ui+horizon_plugins\', \'messages\': <django.contrib.messages.storage.fallback.FallbackStorage object at 0x7f3f0858e290>, u\'STATIC_URL\': \'/static/\', u\'LANGUAGES\': ((\'cs\', \'Czech\'), (\'de\', \'German\'), (\'en\', \'English\'), (\'en-au\', \'Australian English\'), (\'en-gb\', \'British English\'), (\'es\', \'Spanish\'), (\'fr\', \'French\'), (\'id\', \'Indonesian\'), (\'it\', \'Italian\'), (\'ja\', \'Japanese\'), (\'ko\', \'Korean (Korea)\'), (\'pl\', \'Polish\'), (\'pt-br\', \'Portuguese (Brazil)\'), (\'ru\', \'Russian\'), (\'tr\', \'Turkish\'), (\'zh-cn\', \'Simplified Chinese\'), (\'zh-tw\', \'Chinese (Taiwan)\')), \'WEBROOT\': \'/\', \'regions\': {\'current\': {\'endpoint\': u\'https://api.cloud.catalyst.net.nz:5000/v2.0\', \'name\': \'Default Region\'}, \'available\': [], \'support\': False}, \'keystone_providers\': {\'support\': False}, \'authorized_tenants\': [<Tenant {u\'description\': u\'\', u\'disabled_by\': u\'\', u\'enabled\': True, u\'disabled_at\': u\'\', u\'id\': u\'55d08ec945f144d9aeec8234e6cdebbc\', u\'name\': u\'feilong.catalyst.net.nz\'}>, <Tenant {u\'enabled\': True, u\'description\': u\'Openstack development tenant\', u\'name\': u\'openstack-dev.catalyst.net.nz\', u\'id\': u\'b23a5e41d1af4c20974bf58b4dff8e5a\'}>], u\'LANGUAGE_CODE\': \'en\', \'HORIZON_CONFIG\': <horizon.conf.LazySettings object at 0x7f3f0d2fce50>, \'DEFAULT_MESSAGE_LEVELS\': {\'DEBUG\': 10, \'INFO\': 20, \'WARNING\': 30, \'SUCCESS\': 25, \'ERROR\': 40}, \'True\': True, u\'LANGUAGE_BIDI\': False, u\'MEDIA_URL\': \'/media/\'}, {}, {\'row_id\': u\'8130d5dc-6db0-4976-bef3-b8655ff5a282\', \'row_actions\': [<CreateSnapshot: snapshot>, <AssociateIP: associate>, <AttachInterface: attach_interface>, <DetachInterface: detach_interface>, <EditInstance: edit>, <AttachVolume: attach_volume>, <DetachVolume: detach_volume>, <UpdateMetadata: update_metadata>, <EditInstanceSecurityGroups: edit_secgroups>, <ConsoleLink: console>, <LogLink: log>, <TogglePause: pause>, <ToggleSuspend: suspend>, <ToggleShelve: shelve>, <ResizeLink: resize>, <LockInstance: lock>, <UnlockInstance: unlock>, <SoftRebootInstance: soft_reboot>, <RebootInstance: reboot>, <StopInstance: stop>, <RebuildInstance: rebuild>, <DeleteInstance: delete>]}, {u\'forloop\': {u\'revcounter0\': 5, u\'last\': False, u\'counter\': 17, u\'parentloop\': {}, u\'revcounter\': 6, u\'counter0\': 16, u\'first\': False}, u\'action\': <UnlockInstance: unlock>}, {}]'

Ying Zuo (yingzuo)
Changed in horizon:
status: New → Confirmed
importance: Undecided → Medium
milestone: none → next
Akihiro Motoki (amotoki)
summary: - VariableDoesNotExis error when enabling DEBUG logging
+ django.template VariableDoesNotExist error when enabling DEBUG logging
Revision history for this message
Akihiro Motoki (amotoki) wrote :

While there is no side effect on the behavior level, this is noisy enough and we should clean this up.

In addition, it looks better to disable DEBUG log from django.template by default.

Changed in horizon:
assignee: nobody → Akihiro Motoki (amotoki)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to horizon (master)

Related fix proposed to branch: master
Review: https://review.opendev.org/675256

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.opendev.org/675256

Akihiro Motoki (amotoki)
Changed in horizon:
assignee: Akihiro Motoki (amotoki) → nobody
Changed in horizon:
assignee: nobody → Akihiro Motoki (amotoki)
status: Confirmed → In Progress
Changed in horizon:
assignee: Akihiro Motoki (amotoki) → Ivan Kolodyazhny (e0ne)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.opendev.org/680996
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=8343014eceb1ada33267be4e671de5690c79d117
Submitter: Zuul
Branch: master

commit 8343014eceb1ada33267be4e671de5690c79d117
Author: Ivan Kolodyazhny <email address hidden>
Date: Mon Sep 9 15:52:33 2019 +0300

    Fix "_data_table_action.html" template usage

    "_data_table_action.html" template required "is_small" variable.
    Without explicit variable declaration this templates renders with
    errors.

    Partial-Bug: #1720893
    Change-Id: I2c956f88a11ca6527c2e9ecf63d7ac34d2bcd971

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

Reviewed: https://review.opendev.org/681034
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=86d13968d889a9d6293a517390d7f53044f5e567
Submitter: Zuul
Branch: master

commit 86d13968d889a9d6293a517390d7f53044f5e567
Author: Ivan Kolodyazhny <email address hidden>
Date: Mon Sep 9 17:28:46 2019 +0300

    Remove unused 'not_list' template argument

    This is unused in Horizon itself and I didn't find any
    references in plugins. Undefined variable leads to
    errors during render in a debug mode.

    Partial-Bug: #1720893

    Change-Id: I9de0b24adfeb48f5fe14676aaec6b17b8eb52207

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

Change abandoned by Walter Doekes (<email address hidden>) on branch: master
Review: https://review.opendev.org/695892
Reason: "the goal is to fix all of those eventually" -> no need to ignore them

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

Change abandoned by Walter Doekes (<email address hidden>) on branch: stable/train
Review: https://review.opendev.org/693005
Reason: I abandoned the master one too

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

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/horizon/+/830944

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

Reviewed: https://review.opendev.org/c/openstack/horizon/+/830944
Committed: https://opendev.org/openstack/horizon/commit/85e20a62e2b986f066484147d0a15446d2699559
Submitter: "Zuul (22348)"
Branch: master

commit 85e20a62e2b986f066484147d0a15446d2699559
Author: Akihiro Motoki <email address hidden>
Date: Fri Feb 25 17:14:53 2022 +0900

    local_settings.py: Disable django.template DEBUG messages

    VariableDoesNotExist error in DEBUG messages from django.template are
    super noisy. It happens even for cases where variables are not defined
    like "default" filter. It also happens with Django built-in templates.
    Previously we tried to fix VariableDoesNotExist errors in our templates,
    but it tunrs out there is no convenient way to prevent it.

    We agreed to disable django.template DEBUG messages by default
    in the horizon weekly meeting [1].

    Closes-Bug: #1720893

    [1] https://meetings.opendev.org/meetings/horizon/2022/horizon.2022-02-23-15.00.log.html#l-105

    Change-Id: Ife9a91c7cd050b30d7f1eca8861a0d6629a23827

Changed in horizon:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/horizon 22.2.0

This issue was fixed in the openstack/horizon 22.2.0 release.

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.