Horizon now needs LESS installed...

Bug #1014735 reported by Jay Pipes
22
This bug affects 5 people
Affects Status Importance Assigned to Milestone
devstack
Fix Released
High
Gabriel Hurley

Bug Description

Horizon installation works via devstack, but going to Horizon in a browser reveals the LESS CSS compiler is not properly installed, which renders Horizon useless, with every page returning:

Unable to apply CompilerFilter (/opt/stack/horizon/openstack_dashboard/wsgi/../../openstack_dashboard/../bin/less/lessc {infile} {outfile})

Tags: horizon
Revision history for this message
Gabriel Hurley (gabriel-hurley) wrote :

That's a horrifically ugly path there... That should be cleaned up using python's os.path.abspath and corrected for devstack since it looks like the path coded there assumed the wrong starting point (which isn't the same when run via WSGI as with the dev server). Should be a pretty simple fix.

Changed in devstack:
status: New → Confirmed
Revision history for this message
Jay Pipes (jaypipes) wrote :

Sorry, Gabriel, I'm not following you... what do we need to do here? Devstack installs Horizon, but apparently after the recent addition of the LESS dependency, that install no longer works properly. What do you advise to get the install working?

Thanks in advance!
-jay

Revision history for this message
Edward (zhang-hare) wrote :

I installed lesscss by using pip but it doesn't work. So I tried to install lesscpy, but failed. It looks like it require python3 environment according to the README file inside of this package.

====================pip log==========================
sudo pip install lesscpy
Downloading/unpacking lesscpy
  Running setup.py egg_info for package lesscpy
    Traceback (most recent call last):
      File "<string>", line 14, in <module>
      File "/home/openstack/build/lesscpy/setup.py", line 25, in <module>
        license=open('LICENSE').read(),
    IOError: [Errno 2] No such file or directory: 'LICENSE'
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 14, in <module>

  File "/home/openstack/build/lesscpy/setup.py", line 25, in <module>

    license=open('LICENSE').read(),

IOError: [Errno 2] No such file or directory: 'LICENSE'

----------------------------------------
Command python setup.py egg_info failed with error code 1
Storing complete log in /home/openstack/.pip/pip.log
====================================================

Revision history for this message
Stuart Stent (stuart-stent) wrote :
Download full text (5.4 KiB)

-- version current horizon git master

This is the traceback output ---

Environment:

Request Method: GET
Request URL: http://api02.dnjpod1.com/dashboard/

Django Version: 1.4
Python Version: 2.6.6
Installed Applications:
('openstack_dashboard',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'compressor',
 'horizon',
 'horizon.dashboards.nova',
 'horizon.dashboards.syspanel',
 'horizon.dashboards.settings')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'openstack_dashboard.middleware.DashboardLogUnhandledExceptionsMiddleware',
 'horizon.middleware.HorizonMiddleware',
 'django.middleware.doc.XViewMiddleware',
 'django.middleware.locale.LocaleMiddleware')

Template error:
In template /usr/lib/python2.6/site-packages/openstack_dashboard/templates/_stylesheets.html, error at line 3
   /bin/sh: /usr/lib/python2.6/site-packages/openstack_dashboard/wsgi/../../openstack_dashboard/../bin/less/lessc: No such file or directory

   1 : {% load compress %}

   2 :

   3 : {% compress css %}

   4 : <link href='{{ STATIC_URL }}dashboard/less/horizon.less' type='text/less' media='screen' rel='stylesheet' />

   5 : {% endcompress %}

   6 :

   7 : <link rel="shortcut icon" href="{{ STATIC_URL }}dashboard/img/favicon.ico"/>

   8 :

Traceback:
File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py" in get_response
  111. response = callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python2.6/site-packages/django/views/decorators/vary.py" in inner_func
  36. response = func(*args, **kwargs)
File "/usr/lib/python2.6/site-packages/openstack_dashboard/wsgi/../../openstack_dashboard/views.py" in splash
  47. return shortcuts.render(request, 'splash.html', {'form': form})
File "/usr/lib/python2.6/site-packages/django/shortcuts/__init__.py" in render
  44. return HttpResponse(loader.render_to_string(*args, **kwargs),
File "/usr/lib/python2.6/site-packages/django/template/loader.py" in render_to_string
  176. return t.render(context_instance)
File "/usr/lib/python2.6/site-packages/django/template/base.py" in render
  140. return self._render(context)
File "/usr/lib/python2.6/site-packages/django/template/base.py" in _render
  134. return self.nodelist.render(context)
File "/usr/lib/python2.6/site-packages/django/template/base.py" in render
  823. bit = self.render_node(node, context)
File "/usr/lib/python2.6/site-packages/django/template/debug.py" in render_node
  74. return node.render(context)
File "/usr/lib/python2.6/site-packages/django/template/loader_tags.py" in render
  155. return self.render_template(self.template, context)
File "/usr/lib/python2.6/site-packages/django/template/loader_tags.py" in render_template
  137. output = template.render(context)
File "/usr/lib/python2.6/site-packages/django/template/base.py" in render
  140. return self._render(context)
File "/us...

Read more...

Revision history for this message
Stuart Stent (stuart-stent) wrote :

Looks like this is 2 issues

1) Horizon looks to now require nodejs installed

the code is then looking for node-less to be installed in /usr/lib/python2.6/site-packages/openstack_dashboard/wsgi/../../openstack_dashboard/../bin/less/lessc

2) This path seems to be incorrect and should be

/usr/lib/python2.6/site-packages/openstack_dashboard/wsgi/../../openstack_dashboard/bin/less/lessc

as otherwise the path ends up in /usr/lib/python2.6/site-packages and the code can't find openstack_dashboard/static

-- On a side node, listing exactly where the npm install should point to would be good

Revision history for this message
Stuart Stent (stuart-stent) wrote :

Looks like line 94 of openstack_dashboard/settings.py is pointing to the wrong place

Revision history for this message
Stuart Stent (stuart-stent) wrote :

Looking further it looks like the lessc scripts are included in the git repo, however in python 2.6 these files are not installed.

This could either be because the directory is not defined in MANIFEST.in, or needs to be defined as data_files in the setup.py

Revision history for this message
Gabriel Hurley (gabriel-hurley) wrote :

I've got a fix for this. Review coming momentarily.

Changed in devstack:
assignee: nobody → Gabriel Hurley (gabriel-hurley)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to devstack (master)

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

Revision history for this message
Edward (zhang-hare) wrote :

The fix works by my test.

Revision history for this message
Edward (zhang-hare) wrote :

Add my analysis. I dumped the command to execute less compiler as follow:
     "/opt/stack/horizon/bin/less/lessc /opt/stack/horizon/openstack_dashboard/static/dashboard/less/horizon.less /tmp/tmpNAba42.css"

The return code is 0 but there's an error message printed in the console which make it very wried:
    "Fatal Python error: Couldn't create autoTLSkey mapping"

So this might not be caused by LESS installation problem.

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

Reviewed: https://review.openstack.org/8770
Committed: http://github.com/openstack-dev/devstack/commit/8b3f438ab83cad88f745bdf9f4f5dc55bdd4ff57
Submitter: Jenkins
Branch: master

commit 8b3f438ab83cad88f745bdf9f4f5dc55bdd4ff57
Author: Gabriel Hurley <email address hidden>
Date: Wed Jun 20 13:14:38 2012 -0700

    Execute Horizon bin script with correct group.

    Fixes bug 1014735.

    Change-Id: I21217fd722ca85124818c1347680734ccd152eb8

Changed in devstack:
status: In Progress → Fix Released
Revision history for this message
Sean McCully (sean-mccully) wrote :

This is not fixed.

Revision history for this message
Sean McCully (sean-mccully) wrote :

Also it is pointless to have a boolean flag if it doesn't matter if its true or false,

COMPRESS_ENABLED = False

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

Duplicates of this bug

Other bug subscribers

Remote bug watches

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