diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2008-04-08 16:48:22 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2008-04-08 16:48:22 +0000 |
commit | 4375f9d65ffb52c455e9601d2de88b17d7f3eb26 (patch) | |
tree | e7321505b693519bd59be11c2c81c01ffe5711a5 /src | |
parent | 48ab43cff593b9020633004c4393e8bf91b5b88b (diff) | |
download | bcfg2-4375f9d65ffb52c455e9601d2de88b17d7f3eb26.tar.gz bcfg2-4375f9d65ffb52c455e9601d2de88b17d7f3eb26.tar.bz2 bcfg2-4375f9d65ffb52c455e9601d2de88b17d7f3eb26.zip |
Patch from jstrunk to support vhost subdirs as the reports root location (Resolves Ticket #537)
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4487 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/Server/Reports/urls.py | 74 |
1 files changed, 44 insertions, 30 deletions
diff --git a/src/lib/Server/Reports/urls.py b/src/lib/Server/Reports/urls.py index cefa4d465..836808c7e 100644 --- a/src/lib/Server/Reports/urls.py +++ b/src/lib/Server/Reports/urls.py @@ -1,45 +1,59 @@ from django.conf.urls.defaults import * +from ConfigParser import ConfigParser, NoSectionError, NoOptionError +c = ConfigParser() +c.read(['/etc/bcfg2.conf', '/etc/bcfg2-web.conf']) + +# web_prefix should have a trailing slash, but no leading slash +# e.g. web_prefix = bcfg2/ +# web_prefix_root is a workaround for the index +if c.has_option('statistics', 'web_prefix'): + web_prefix = c.get('statistics', 'web_prefix').lstrip('/') + web_prefix_root = web_prefix +else: + web_prefix = '' + web_prefix_root = '/' + urlpatterns = patterns('', # Example: - # (r'^Bcfg2.Server.Reports/', include('Bcfg2.Server.Reports.apps.foo.urls.foo')), - (r'^/*$','Bcfg2.Server.Reports.reports.views.index'), - - (r'^clients/(?P<timestamp>(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])@([01][0-9]|2[0-3]):([0-5][0-9]|60):([0-5][0-9]|60))/$','Bcfg2.Server.Reports.reports.views.client_index'), - (r'^clients/(?P<hostname>\S+)/(?P<pk>\d+)/$', 'Bcfg2.Server.Reports.reports.views.client_detail'), - (r'^clients/(?P<hostname>\S+)/manage/$', 'Bcfg2.Server.Reports.reports.views.client_manage'), - (r'^clients/(?P<hostname>\S+)/$', 'Bcfg2.Server.Reports.reports.views.client_detail'), - (r'^clients/(?P<hostname>\S+)$', 'Bcfg2.Server.Reports.reports.views.client_detail'), + # (r'^%sBcfg2.Server.Reports/' % web_prefix, include('Bcfg2.Server.Reports.apps.foo.urls.foo')), + (r'^%s*$' % web_prefix_root,'Bcfg2.Server.Reports.reports.views.index'), + + (r'^%sclients/(?P<timestamp>(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])@([01][0-9]|2[0-3]):([0-5][0-9]|60):([0-5][0-9]|60))/$' % web_prefix,'Bcfg2.Server.Reports.reports.views.client_index'), + (r'^%sclients/(?P<hostname>\S+)/(?P<pk>\d+)/$' % web_prefix, 'Bcfg2.Server.Reports.reports.views.client_detail'), + (r'^%sclients/(?P<hostname>\S+)/manage/$' % web_prefix, 'Bcfg2.Server.Reports.reports.views.client_manage'), + (r'^%sclients/(?P<hostname>\S+)/$' % web_prefix, 'Bcfg2.Server.Reports.reports.views.client_detail'), + (r'^%sclients/(?P<hostname>\S+)$' % web_prefix, 'Bcfg2.Server.Reports.reports.views.client_detail'), #hack because hostnames have periods and we still want to append slash - (r'^clients/$','Bcfg2.Server.Reports.reports.views.client_index'), - (r'^displays/sys-view/(?P<timestamp>(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])@([01][0-9]|2[0-3]):([0-5][0-9]|60):([0-5][0-9]|60))/$','Bcfg2.Server.Reports.reports.views.display_sys_view'), - (r'^displays/sys-view/$','Bcfg2.Server.Reports.reports.views.display_sys_view'), - (r'^displays/summary/(?P<timestamp>(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])@([01][0-9]|2[0-3]):([0-5][0-9]|60):([0-5][0-9]|60))/$','Bcfg2.Server.Reports.reports.views.display_summary'), - (r'^displays/summary/$','Bcfg2.Server.Reports.reports.views.display_summary'), - (r'^displays/timing/(?P<timestamp>(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])@([01][0-9]|2[0-3]):([0-5][0-9]|60):([0-5][0-9]|60))/$','Bcfg2.Server.Reports.reports.views.display_timing'), - (r'^displays/timing/$','Bcfg2.Server.Reports.reports.views.display_timing'), - (r'^displays/$','Bcfg2.Server.Reports.reports.views.display_index'), - - (r'^elements/modified/(?P<eyedee>\d+)/(?P<timestamp>(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])@([01][0-9]|2[0-3]):([0-5][0-9]|60):([0-5][0-9]|60))/$','Bcfg2.Server.Reports.reports.views.config_item_modified'), - (r'^elements/modified/(?P<eyedee>\d+)/$','Bcfg2.Server.Reports.reports.views.config_item_modified'), - (r'^elements/modified/(?P<timestamp>(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])@([01]\ - [0-9]|2[0-3]):([0-5][0-9]|60):([0-5][0-9]|60))/$','Bcfg2.Server.Reports.reports.views.modified_item_index'), - (r'^elements/modified/$','Bcfg2.Server.Reports.reports.views.modified_item_index'), - (r'^elements/bad/(?P<eyedee>\d+)/(?P<timestamp>(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])@([01][0-9]|2[0-3]):([0-5][0-9]|60):([0-5][0-9]|60))/$','Bcfg2.Server.Reports.reports.views.config_item_bad'), - (r'^elements/bad/(?P<eyedee>\d+)/$','Bcfg2.Server.Reports.reports.views.config_item_bad'), - (r'^elements/bad/(?P<timestamp>(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])@([01]\ - [0-9]|2[0-3]):([0-5][0-9]|60):([0-5][0-9]|60))/$','Bcfg2.Server.Reports.reports.views.bad_item_index'), - (r'^elements/bad/$','Bcfg2.Server.Reports.reports.views.bad_item_index'), + (r'^%sclients/$' % web_prefix,'Bcfg2.Server.Reports.reports.views.client_index'), + (r'^%sdisplays/sys-view/(?P<timestamp>(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])@([01][0-9]|2[0-3]):([0-5][0-9]|60):([0-5][0-9]|60))/$' % web_prefix,'Bcfg2.Server.Reports.reports.views.display_sys_view'), + (r'^%sdisplays/sys-view/$' % web_prefix,'Bcfg2.Server.Reports.reports.views.display_sys_view'), + (r'^%sdisplays/summary/(?P<timestamp>(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])@([01][0-9]|2[0-3]):([0-5][0-9]|60):([0-5][0-9]|60))/$' % web_prefix,'Bcfg2.Server.Reports.reports.views.display_summary'), + (r'^%sdisplays/summary/$' % web_prefix,'Bcfg2.Server.Reports.reports.views.display_summary'), + (r'^%sdisplays/timing/(?P<timestamp>(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])@([01][0-9]|2[0-3]):([0-5][0-9]|60):([0-5][0-9]|60))/$' % web_prefix,'Bcfg2.Server.Reports.reports.views.display_timing'), + (r'^%sdisplays/timing/$' % web_prefix,'Bcfg2.Server.Reports.reports.views.display_timing'), + (r'^%sdisplays/$' % web_prefix,'Bcfg2.Server.Reports.reports.views.display_index'), + + (r'^%selements/modified/(?P<eyedee>\d+)/(?P<timestamp>(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])@([01][0-9]|2[0-3]):([0-5][0-9]|60):([0-5][0-9]|60))/$' % web_prefix,'Bcfg2.Server.Reports.reports.views.config_item_modified'), + (r'^%selements/modified/(?P<eyedee>\d+)/$' % web_prefix,'Bcfg2.Server.Reports.reports.views.config_item_modified'), + (r'^%selements/modified/(?P<timestamp>(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])@([01]\ + [0-9]|2[0-3]):([0-5][0-9]|60):([0-5][0-9]|60))/$' % web_prefix,'Bcfg2.Server.Reports.reports.views.modified_item_index'), + (r'^%selements/modified/$' % web_prefix,'Bcfg2.Server.Reports.reports.views.modified_item_index'), + (r'^%selements/bad/(?P<eyedee>\d+)/(?P<timestamp>(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])@([01][0-9]|2[0-3]):([0-5][0-9]|60):([0-5][0-9]|60))/$' % web_prefix,'Bcfg2.Server.Reports.reports.views.config_item_bad'), + (r'^%selements/bad/(?P<eyedee>\d+)/$' % web_prefix,'Bcfg2.Server.Reports.reports.views.config_item_bad'), + (r'^%selements/bad/(?P<timestamp>(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])@([01]\ + [0-9]|2[0-3]):([0-5][0-9]|60):([0-5][0-9]|60))/$' % web_prefix,'Bcfg2.Server.Reports.reports.views.bad_item_index'), + (r'^%selements/bad/$' % web_prefix,'Bcfg2.Server.Reports.reports.views.bad_item_index'), ) # Uncomment this for admin: - #(r'^admin/', include('django.contrib.admin.urls')), + #(r'^%sadmin/' % web_prefix, include('django.contrib.admin.urls')), ## Uncomment this section if using authentication #urlpatterns += patterns('', -# (r'^login/$', 'django.contrib.auth.views.login', +# (r'^%slogin/$' % web_prefix, 'django.contrib.auth.views.login', # {'template_name': 'auth/login.html'}), -# (r'^logout/$', 'django.contrib.auth.views.logout', +# (r'^%slogout/$' % web_prefix, 'django.contrib.auth.views.logout', # {'template_name': 'auth/logout.html'}) # ) |