[graphite-web/f20] Patch for fix loading dashboards by name (RHBZ#1014349), Patch for log name of metric that throws ex

Jonathan Steffan jsteffan at fedoraproject.org
Tue Oct 1 23:24:47 UTC 2013


commit be88b022188adf7cbed3cc520aa0d4d64972ebcd
Author: Jonathan Steffan <jsteffan at fedoraproject.org>
Date:   Tue Oct 1 17:24:38 2013 -0600

    Patch for fix loading dashboards by name (RHBZ#1014349), Patch for log name of metric that throws exception for CarbonLink (RHBZ#1014349), Add deque to the PICKLE_SAFE filter (RHBZ#1014356), Merge in EL5 conditionals for single spec

 graphite-web-0.9.12-carbonlink-exception-log.patch |   18 ++++++++
 graphite-web-0.9.12-dashboard-load.patch           |   30 +++++++++++++
 ...e-web-0.9.12-safe-unpickle-deque-addition.patch |   30 +++++++++++++
 graphite-web.spec                                  |   45 ++++++++++++++++++--
 4 files changed, 119 insertions(+), 4 deletions(-)
---
diff --git a/graphite-web-0.9.12-carbonlink-exception-log.patch b/graphite-web-0.9.12-carbonlink-exception-log.patch
new file mode 100644
index 0000000..250dac1
--- /dev/null
+++ b/graphite-web-0.9.12-carbonlink-exception-log.patch
@@ -0,0 +1,18 @@
+Log metric that produced exception.
+
+Merge to upstream 0.9.x branch requested at
+https://github.com/graphite-project/graphite-web/pull/446
+
+diff --git a/webapp/graphite/render/datalib.py b/webapp/graphite/render/datalib.py
+index cbd5f4c..bb60bd2 100644
+--- a/webapp/graphite/render/datalib.py
++++ b/webapp/graphite/render/datalib.py
+@@ -231,7 +231,7 @@ def fetchData(requestContext, pathExpr):
+       cachedResults = CarbonLink.query(dbFile.real_metric)
+       results = mergeResults(dbResults, cachedResults)
+     except:
+-      log.exception()
++      log.exception("Failed CarbonLink query '%s'" % dbFile.real_metric)
+       results = dbResults
+ 
+     if not results:
diff --git a/graphite-web-0.9.12-dashboard-load.patch b/graphite-web-0.9.12-dashboard-load.patch
new file mode 100644
index 0000000..61bd790
--- /dev/null
+++ b/graphite-web-0.9.12-dashboard-load.patch
@@ -0,0 +1,30 @@
+From cb89c8249c2ad1ad6beae942c017564ad6d7fb4b Mon Sep 17 00:00:00 2001
+From: Christopher Bowman <cbowman0 at gmail.com>
+Date: Wed, 28 Aug 2013 18:45:16 +0000
+Subject: [PATCH] JSON.parse the escaped JSON for initialState.
+
+This resolves the issue of dashboards not loading when passed as /dashboard/<name>.
+
+Tracked upstream as https://github.com/graphite-project/graphite-web/issues/411
+Backported to pristine 0.9.12.
+
+diff --git a/webapp/graphite/templates/dashboard.html b/webapp/graphite/templates/dashboard.html
+index ebd2609..93aeaf9 100644
+--- graphite-web-0.9.12/webapp/graphite/templates/dashboard.html
++++ graphite-web-0.9.12/webapp/graphite/templates/dashboard.html
+@@ -23,13 +23,13 @@
+     var HELP_ICON     = '/content/js/ext/examples/shared/icons/fam/information.png';
+ 
+     {% if initialState %}
+-    var initialState = "{{ initialState|escapejs }}";
++    var initialState = JSON.parse('{{ initialState|escapejs }}');
+     {% else %}
+     var initialState = null;
+     {% endif %}
+ 
+     {% if initialError %}
+-    var initialError = "{{ initialError|escapejs }}";
++    var initialError = '{{ initialError|escapejs }}';
+     {% else %}
+     var initialError = null;
+     {% endif %}
diff --git a/graphite-web-0.9.12-safe-unpickle-deque-addition.patch b/graphite-web-0.9.12-safe-unpickle-deque-addition.patch
new file mode 100644
index 0000000..3b09761
--- /dev/null
+++ b/graphite-web-0.9.12-safe-unpickle-deque-addition.patch
@@ -0,0 +1,30 @@
+One possible fix for https://github.com/graphite-project/graphite-web/issues/423
+
+diff --git a/webapp/graphite/util.py b/webapp/graphite/util.py
+index 89709d8..255e5e2 100644
+--- a/webapp/graphite/util.py
++++ b/webapp/graphite/util.py
+@@ -29,6 +29,7 @@ from django.core.exceptions import ObjectDoesNotExist
+ from django.contrib.auth.models import User
+ from graphite.account.models import Profile
+ from graphite.logger import log
++import sys
+ 
+ 
+ # There are a couple different json modules floating around out there with
+@@ -89,6 +90,7 @@ if USING_CPICKLE:
+     PICKLE_SAFE = {
+       'copy_reg': set(['_reconstructor']),
+       '__builtin__': set(['object']),
++      'collections': set(['deque']),
+     }
+ 
+     @classmethod
+@@ -112,6 +114,7 @@ else:
+     PICKLE_SAFE = {
+       'copy_reg': set(['_reconstructor']),
+       '__builtin__': set(['object']),
++      'collections': set(['deque']),
+     }
+ 
+     def find_class(self, module, name):
diff --git a/graphite-web.spec b/graphite-web.spec
index 711cad0..0660414 100644
--- a/graphite-web.spec
+++ b/graphite-web.spec
@@ -1,7 +1,10 @@
+%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
+
 Name:           graphite-web
 Version:        0.9.12
-Release:        4%{?dist}
+Release:        5%{?dist}
 Summary:        A Django webapp for enterprise scalable realtime graphing
+Group:          Applications/Internet
 
 License:        ASL 2.0
 URL:            https://launchpad.net/graphite/
@@ -10,6 +13,9 @@ Source1:        graphite-web-vhost.conf
 Source2:        graphite-web-README.fedora
 Source3:        graphite-web-README.selinux
 Patch0:         graphite-web-0.9.12-fhs-thirdparty.patch
+Patch1:         graphite-web-0.9.12-dashboard-load.patch
+Patch2:         graphite-web-0.9.12-carbonlink-exception-log.patch
+Patch3:         graphite-web-0.9.12-safe-unpickle-deque-addition.patch
 BuildRoot:      %{_tmppath}/graphite-web-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildArch:      noarch
@@ -43,6 +49,7 @@ scalability.
 
 %package selinux
 Summary:        SELinux labeling for graphite files
+Group:          Applications/Internet
 Requires:       %name = %version-%release
 %if 0%{?el5}
 Requires(post): policycoreutils
@@ -62,6 +69,12 @@ SELinux labeling for graphite files.
 # Patch for Filesystem Hierarchy Standard
 # Remove thridparty libs
 %patch0 -p1
+# Fix loading dashboards by name (https://github.com/graphite-project/graphite-web/issues/411)
+%patch1 -p1
+# Log name of metric that throws exception for CarbonLink (https://github.com/graphite-project/graphite-web/pull/446)
+%patch2 -p1
+# Add deque to the PICKLE_SAFE filter (https://github.com/graphite-project/graphite-web/issues/423)
+%patch3 -p1
 %{__install} -m 644 %{SOURCE2} README.fedora
 %{__install} -m 644 %{SOURCE3} README.selinux
 
@@ -82,9 +95,14 @@ rm -rf %{buildroot}
 # Install some default configurations and wsgi
 %{__install} -Dp -m0644 conf/dashboard.conf.example %{buildroot}%{_sysconfdir}/graphite-web/dashboard.conf
 %{__install} -Dp -m0644 webapp/graphite/local_settings.py.example %{buildroot}%{_sysconfdir}/graphite-web/local_settings.py
-%{__install} -Dp -m0644 conf/graphite.wsgi.example %{buildroot}%{_datarootdir}/graphite/graphite-web.wsgi
 %{__install} -Dp -m0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/httpd/conf.d/graphite-web.conf
 
+%if 0%{?el5}
+%{__install} -Dp -m0644 conf/graphite.wsgi.example %{buildroot}%{_datadir}/graphite/graphite-web.wsgi
+%else
+%{__install} -Dp -m0644 conf/graphite.wsgi.example %{buildroot}%{_datarootdir}/graphite/graphite-web.wsgi
+%endif
+
 # Configure django /media/ location
 sed -i 's|##PYTHON_SITELIB##|%{python_sitelib}|' %{buildroot}%{_sysconfdir}/httpd/conf.d/graphite-web.conf
 
@@ -97,10 +115,16 @@ popd
 %{__rm} %{buildroot}%{_bindir}/{build-index.sh,run-graphite-devel-server.py}
 
 # Fix permissions
-%{__chmod} 0644 %{buildroot}%{_datarootdir}/graphite/webapp/content/js/window/*
 %{__chmod} 0644 conf/graphite.wsgi.example
 %{__chmod} 0755 %{buildroot}%{python_sitelib}/graphite/manage.py
 
+%if 0%{?el5}
+%{__chmod} 0644 %{buildroot}%{_datadir}/graphite/webapp/content/js/window/*
+%else
+%{__chmod} 0644 %{buildroot}%{_datarootdir}/graphite/webapp/content/js/window/*
+%endif
+
+
 # Don't ship thirdparty
 %{__rm} -rf %{buildroot}%{python_sitelib}/graphite/thirdparty
 
@@ -122,19 +146,32 @@ fi
 %files
 %doc README.fedora LICENSE conf/* examples/*
 %{python_sitelib}/graphite*
-%{_datarootdir}/graphite
+
 %config(noreplace) %{_sysconfdir}/httpd/conf.d/graphite-web.conf
 %config(noreplace) %{_sysconfdir}/graphite-web/local_settings.py
 %ghost %{_sysconfdir}/graphite-web/local_settings.pyc
 %ghost %{_sysconfdir}/graphite-web/local_settings.pyo
 %config(noreplace) %{_sysconfdir}/graphite-web/dashboard.conf
 %attr(-,apache,apache) %dir %{_localstatedir}/log/graphite-web
+
+%if 0%{?el5}
+%{_datadir}/graphite
+%attr(-,apache,apache) %dir %{_localstatedir}/lib/graphite-web
+%else
+%{_datarootdir}/graphite
 %attr(-,apache,apache) %dir %{_sharedstatedir}/graphite-web
+%endif
 
 %files selinux
 %doc README.selinux
 
 %changelog
+* Tue Oct 01 2013 Jonathan Steffan <jsteffan at fedoraproject.org> - 0.9.12-5
+- Patch for fix loading dashboards by name (RHBZ#1014349)
+- Patch for log name of metric that throws exception for CarbonLink (RHBZ#1014349)
+- Add deque to the PICKLE_SAFE filter (RHBZ#1014356)
+- Merge in EL5 conditionals for single spec
+
 * Mon Sep 30 2013 Jonathan Steffan <jsteffan at fedoraproject.org> - 0.9.12-4
 - Remove logrotate configuration as it conflicts with internal
   log rotation (RHBZ#1008616)


More information about the scm-commits mailing list