Ticket #537 (closed defect: fixed)
Add setting in config file for reports in a subdirctory
Reported by: | [email protected]… | Owned by: | desai |
---|---|---|---|
Priority: | minor | Milestone: | Bcfg2 0.9.6 Release |
Component: | bcfg2-server | Version: | |
Keywords: | Cc: |
Description
There is a patch for bcfg2/src/lib/Server/Reports/urls.py at http://www.ma.utexas.edu/users/jstrunk/web_prefix.diff
There is probably a better place to use ConfigParser?, but I am not so sure since that module only imports something from django.
The new setting is called "web_prefix". It is found in the [statistics] section of the bcfg2-web.conf . It needs to have a trailing '/' but no leading '/'.
The bug that this patch fixes is when you access the dynamic reports from a subdirectory instead of the document root of a virtualhost, you must modify urls.py to include that subdirectory. Otherwise, you get the following error if debug is on.
Page not found (404) Request Method: GET Request URL: http://localhost/bcfg2/displays/summary/ Using the URLconf defined in Bcfg2.Server.Reports.urls, Django tried these URL patterns, in this order: 1. ^/*$ 2. ^clients/(?P<timestamp>(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[dee158e0d75ced9dffe19c101e4ebc93b4858156] (SVN r12)[0-9]|3[01])@([01][0-9]|2[0-3]):([0-5][0-9]|60):([0-5][0-9]|60))/$ 3. ^clients/(?P<hostname>\S+)/(?P<pk>\d+)/$ 4. ^clients/(?P<hostname>\S+)/manage/$ 5. ^clients/(?P<hostname>\S+)/$ 6. ^clients/(?P<hostname>\S+)$ 7. ^clients/$ 8. ^displays/sys-view/(?P<timestamp>(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[dee158e0d75ced9dffe19c101e4ebc93b4858156] (SVN r12)[0-9]|3[01])@([01][0-9]|2[0-3]):([0-5][0-9]|60):([0-5][0-9]|60))/$ 9. ^displays/sys-view/$ 10. ^displays/summary/(?P<timestamp>(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[dee158e0d75ced9dffe19c101e4ebc93b4858156] (SVN r12)[0-9]|3[01])@([01][0-9]|2[0-3]):([0-5][0-9]|60):([0-5][0-9]|60))/$ 11. ^displays/summary/$ 12. ^displays/timing/(?P<timestamp>(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[dee158e0d75ced9dffe19c101e4ebc93b4858156] (SVN r12)[0-9]|3[01])@([01][0-9]|2[0-3]):([0-5][0-9]|60):([0-5][0-9]|60))/$ 13. ^displays/timing/$ 14. ^displays/$ 15. ^elements/modified/(?P<eyedee>\d+)/(?P<timestamp>(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[dee158e0d75ced9dffe19c101e4ebc93b4858156] (SVN r12)[0-9]|3[01])@([01][0-9]|2[0-3]):([0-5][0-9]|60):([0-5][0-9]|60))/$ 16. ^elements/modified/(?P<eyedee>\d+)/$ 17. ^elements/modified/(?P<timestamp>(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[dee158e0d75ced9dffe19c101e4ebc93b4858156] (SVN r12)[0-9]|3[01])@([01]\ [0-9]|2[0-3]):([0-5][0-9]|60):([0-5][0-9]|60))/$ 18. ^elements/modified/$ 19. ^elements/bad/(?P<eyedee>\d+)/(?P<timestamp>(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[dee158e0d75ced9dffe19c101e4ebc93b4858156] (SVN r12)[0-9]|3[01])@([01][0-9]|2[0-3]):([0-5][0-9]|60):([0-5][0-9]|60))/$ 20. ^elements/bad/(?P<eyedee>\d+)/$ 21. ^elements/bad/(?P<timestamp>(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[dee158e0d75ced9dffe19c101e4ebc93b4858156] (SVN r12)[0-9]|3[01])@([01]\ [0-9]|2[0-3]):([0-5][0-9]|60):([0-5][0-9]|60))/$ 22. ^elements/bad/$ The current URL, /bcfg2/displays/summary/, didn't match any of these. You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page.
Attachments
Change History
comment:3 Changed 15 years ago by [email protected]…
- Status changed from closed to reopened
- Resolution fixed deleted
This patch seems to already be in 0.9.5.7. Following the docu for setting up the new report system? one gets
# python /usr/lib/python2.4/site-packages/Bcfg2/Server/Reports/importscript.py Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/Bcfg2/Server/Reports/importscript.py", line 6, in ? import settings File "/usr/lib/python2.4/site-packages/Bcfg2/Server/Reports/settings.py", line 6, in ? if c.get('statistics', 'web_debug') == "True": File "/usr/lib64/python2.4/ConfigParser.py", line 520, in get raise NoOptionError(option, section) ConfigParser.NoOptionError: No option 'web_debug' in section: 'statistics'
This means that either the web_debug setting under statistics in /etc/bcfg2-web.conf should be mandatory or the check should deal with no such setting existing.
comment:4 Changed 15 years ago by desai
- Status changed from reopened to closed
- Resolution set to fixed
Fixed in [4779] and [481f8a7074160ecf03796700cb6de1d800f417a1] (SVN r4880) for the stable branch and 0.9.6 respectively. Thanks for the report.
Committed in r4487 and will be included in 0.9.6pre1. Thanks for the patch.