summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Laszlo <tim.laszlo@gmail.com>2010-10-19 11:45:53 -0500
committerSol Jerome <sol.jerome@gmail.com>2010-11-02 20:35:18 -0500
commitd594844a9f5ebc0f26f35d03fcf1f90de4ef2d6a (patch)
tree6db4c913803f229722ca3a8effb6ed5e4eee1147
parentb6c96eabe1c2ad98897abc2a4fa24ff01af49f68 (diff)
downloadbcfg2-d594844a9f5ebc0f26f35d03fcf1f90de4ef2d6a.tar.gz
bcfg2-d594844a9f5ebc0f26f35d03fcf1f90de4ef2d6a.tar.bz2
bcfg2-d594844a9f5ebc0f26f35d03fcf1f90de4ef2d6a.zip
web_reports: determine static prefix automatically
-rw-r--r--misc/bcfg2.spec54
-rw-r--r--src/lib/Server/Reports/reports/templates/base.html16
-rw-r--r--src/lib/Server/Reports/reports/templatetags/bcfg2_tags.py35
3 files changed, 96 insertions, 9 deletions
diff --git a/misc/bcfg2.spec b/misc/bcfg2.spec
index 72008435a..c38e52c3b 100644
--- a/misc/bcfg2.spec
+++ b/misc/bcfg2.spec
@@ -13,7 +13,7 @@
%define lxmldep %(rpm -q %{alt_lxml} 2>&1 > /dev/null && echo %{alt_lxml} || echo %{dfl_lxml})
Name: bcfg2
-Version: 1.1.0
+Version: 1.2.0
Release: %{release}
Summary: Configuration management system
@@ -93,6 +93,39 @@ systems are constantly changing; if required in your environment,
Bcfg2 can enable the construction of complex change management and
deployment strategies.
+%package -n bcfg2-web
+Version: %{version}
+Summary: Bcfg2 Web Reporting Interface
+Group: System Tools
+Requires: bcfg2-server
+Requires: httpd,mod_wsgi,Django
+
+%description -n bcfg2-web
+Bcfg2 helps system administrators produce a consistent, reproducible,
+and verifiable description of their environment, and offers
+visualization and reporting tools to aid in day-to-day administrative
+tasks. It is the fifth generation of configuration management tools
+developed in the Mathematics and Computer Science Division of Argonne
+National Laboratory.
+
+It is based on an operational model in which the specification can be
+used to validate and optionally change the state of clients, but in a
+feature unique to bcfg2 the client's response to the specification can
+also be used to assess the completeness of the specification. Using
+this feature, bcfg2 provides an objective measure of how good a job an
+administrator has done in specifying the configuration of client
+systems. Bcfg2 is therefore built to help administrators construct an
+accurate, comprehensive specification.
+
+Bcfg2 has been designed from the ground up to support gentle
+reconciliation between the specification and current client states. It
+is designed to gracefully cope with manual system modifications.
+
+Finally, due to the rapid pace of updates on modern networks, client
+systems are constantly changing; if required in your environment,
+Bcfg2 can enable the construction of complex change management and
+deployment strategies.
+
%prep
%setup -q -n bcfg2-%{version}
@@ -117,6 +150,11 @@ deployment strategies.
%{__install} -m 755 debian/bcfg2.cron.hourly %{buildroot}%{_sysconfdir}/cron.hourly/bcfg2
%{__install} -m 755 tools/bcfg2-cron %{buildroot}%{_prefix}/lib/bcfg2/bcfg2-cron
+%if "%{_vendor}" == "redhat"
+%{__install} -d %{buildroot}%{_sysconfdir}/httpd/conf.d
+%{__install} -m 644 misc/apache/bcfg2.conf %{buildroot}%{_sysconfdir}/httpd/conf.d/bcfg2.conf
+%endif
+
%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot} || exit 2
@@ -147,7 +185,10 @@ deployment strategies.
%{python_sitelib}/*egg-info
%endif
-%{_datadir}/bcfg2
+%dir %{_datadir}/bcfg2
+%{_datadir}/bcfg2/Hostbase
+%{_datadir}/bcfg2/schemas
+%{_datadir}/bcfg2/xsl-transforms
%config(noreplace) %{_sysconfdir}/default/bcfg2-server
%{_sbindir}/bcfg2-admin
%{_sbindir}/bcfg2-build-reports
@@ -160,6 +201,15 @@ deployment strategies.
%{_mandir}/man8/*.8*
%dir %{_prefix}/lib/bcfg2
+%files -n bcfg2-web
+%defattr(-,root,root,-)
+
+%{_datadir}/bcfg2/site_media
+
+%if "%{_vendor}" == "redhat"
+%config(noreplace) %{_sysconfdir}/httpd/conf.d/bcfg2.conf
+%endif
+
%changelog
* Mon Jun 21 2010 Fabian Affolter <fabian@bernewireless.net> - 1.1.0rc3-0.1
- Changed source0 in order that it works with spectool
diff --git a/src/lib/Server/Reports/reports/templates/base.html b/src/lib/Server/Reports/reports/templates/base.html
index 7a36c9893..9bd9da218 100644
--- a/src/lib/Server/Reports/reports/templates/base.html
+++ b/src/lib/Server/Reports/reports/templates/base.html
@@ -1,3 +1,5 @@
+{% load bcfg2_tags %}
+
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
@@ -10,19 +12,19 @@
<meta name="robots" content="noindex, nofollow" />
<meta http-equiv="cache-control" content="no-cache" />
-<link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}/bcfg2_base.css" media="all" />
-<script type="text/javascript" src="{{ MEDIA_URL }}/bcfg2.js"></script>
-<script type="text/javascript" src="{{ MEDIA_URL }}/date.js"></script>
-<script type="text/javascript" src="{{ MEDIA_URL }}/AnchorPosition.js"></script>
-<script type="text/javascript" src="{{ MEDIA_URL }}/CalendarPopup.js"></script>
-<script type="text/javascript" src="{{ MEDIA_URL }}/PopupWindow.js"></script>
+<link rel="stylesheet" type="text/css" href="{% to_media_url bcfg2_base.css %}" media="all" />
+<script type="text/javascript" src="{% to_media_url bcfg2.js %}"></script>
+<script type="text/javascript" src="{% to_media_url date.js %}"></script>
+<script type="text/javascript" src="{% to_media_url AnchorPosition.js %}"></script>
+<script type="text/javascript" src="{% to_media_url CalendarPopup.js %}"></script>
+<script type="text/javascript" src="{% to_media_url PopupWindow.js %}"></script>
{% block extra_header_info %}{% endblock %}
</head>
<body onload="{% block body_onload %}{% endblock %}">
<div id="header">
- <a href="http://bcfg2.org"><img src='{{ MEDIA_URL }}/bcfg2_logo.png'
+ <a href="http://bcfg2.org"><img src='{% to_media_url bcfg2_logo.png %}'
height='115' width='300' alt='Bcfg2' style='float:left; height: 115px' /></a>
</div>
diff --git a/src/lib/Server/Reports/reports/templatetags/bcfg2_tags.py b/src/lib/Server/Reports/reports/templatetags/bcfg2_tags.py
index 8285915bd..7fffe289d 100644
--- a/src/lib/Server/Reports/reports/templatetags/bcfg2_tags.py
+++ b/src/lib/Server/Reports/reports/templatetags/bcfg2_tags.py
@@ -237,3 +237,38 @@ def sortwell(value):
configItems.sort(lambda x,y: cmp(x.entry.kind, y.entry.kind))
return configItems
+class MediaTag(template.Node):
+ def __init__(self, filter_value):
+ self.filter_value = filter_value
+
+ def render(self, context):
+ base = context['MEDIA_URL']
+ try:
+ request = context['request']
+ try:
+ base = request.environ['bcfg2.media_url']
+ except:
+ if request.path != request.META['PATH_INFO']:
+ offset = request.path.find(request.META['PATH_INFO'])
+ if offset > 0:
+ base = "%s/%s" % (request.path[:offset], \
+ context['MEDIA_URL'].strip('/'))
+ except:
+ pass
+ return "%s/%s" % (base, self.filter_value)
+
+@register.tag
+def to_media_url(parser, token):
+ """
+ Return a url relative to the media_url.
+
+ {% to_media_url /bcfg2.css %}
+ """
+ try:
+ tag_name, filter_value = token.split_contents()
+ filter_value = parser.compile_filter(filter_value)
+ except ValueError:
+ raise template.TemplateSyntaxError, "%r tag requires exactly one argument" % token.contents.split()[0]
+
+ return MediaTag(filter_value)
+