[openstack-dev] Horizon customization_module feature doesn't work
Gabriel Hurley
Gabriel.Hurley at nebula.com
Sun Nov 11 22:35:35 UTC 2012
While I agree there ought to be a unit test for it, I can tell you definitively that it *does* work since I have internal projects using it (not public). As to why it’s not working for you… without seeing code I can tell you about how it works and perhaps you can make some deducations from there. For reference, the code is here: https://github.com/openstack/horizon/blob/master/horizon/base.py#L743
First, the code looks to see if a customization_module has been specified. If not, it moves on. If there is one, it tries to split the dotted python path string into a package and a module name that can be imported. It then tries to import the module from the package. If this succeeds then all the code in the module is executed (as part of Python’s import process). If it fails there are two code paths:
1. It failed because it was able to import the module from the package but there was some other error, in which case it should re-raise that error.
2. It failed because it could not import either the package or the module, in which case it puts things back as it was and moves along.
Case #2 should probably have better debugging facilities, and it sounds like that’s what’s happening to you. Why it’s unable to locate/import your module I don’t know. There are all the innumerable common path problems, missing __init__.py files, etc. which could be to blame. Python path issues are always a nuisance.
If you want to post your code explicitly somewhere then the community can help review/debug. If you’d like to work on the ticket for improving testing/debugging around the customization_module code the ticket is here: https://bugs.launchpad.net/horizon/+bug/1077744
Hopefully all that helps,
- Gabriel
From: Daniel McDougall [mailto:daniel.mcdougall at liftoffsoftware.com]
Sent: Saturday, November 10, 2012 6:51 PM
To: openstack-dev at lists.openstack.org
Subject: [openstack-dev] Horizon customization_module feature doesn't work
I am developing a Gate One (https://github.com/liftoff/GateOne/) module for Horizon (so you can get a real terminal instead of the can't-copy-and-paste VNC one). I've got it working great if I manually make changes to tabs.py, tables.py, views.py, and urls.py inside of openstack_dashboard/dashboards/project/. This adds a tab to the 'Instance Detail' page alongside 'Log' and 'VNC' named, 'SSH' that instantly connects you to your instance when you click on it; providing a really nice HTML5 terminal interface for your instance (that you can, you know, copy & paste in and out of =).
However, I don't like the idea of modifying the code in place (upgrading Horizon would overwrite my changes). Along these lines I tried to use the customization_module feature described here: http://docs.openstack.org/developer/horizon/topics/customizing.html
...but it doesn't work. I literally copied & pasted the example and I get nothing (the /settings/ page still shows the name as "OpenStack API"). Not even an error message in the Apache logs or on the page. Zero changes. I've restarted apache and whatnot. Making changes to other sections of the settings.py take effect just fine (e.g. SITE_BRANDING). I even did this to see if I could get it to generate an error:
HORIZON_CONFIG = {
<all the normal stuff>,
'customization_module': 'nonexistent.override'
}
...but I get no error from that. Nothing at all, in fact. The setting doesn't appear to do anything at all. I've tried placing the overrides.py file all over the place. Inside of openstack_dashboard (as openstack_dashboard.overrides), myproject, etc etc. No matter what I try it seems to have no impact.
My conclusion is that this feature just plain doesn't work. There is no existing tests for it and despite much googling I couldn't find a single example of it in use. There is literally not a single .py file indexed in Google that has 'customization_module' in it except for Horizon's on base.py.
Maybe the customization_module feature is the wrong way to go about this; I'm just getting started with Horizon. Any suggestions or ideas are appreciated.
--
Dan McDougall - Chief Executive Officer and Developer
Liftoff Software ✈ Your flight to the cloud is now boarding.
904-446-8323
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20121111/67df1020/attachment.html>
More information about the OpenStack-dev
mailing list