From cd0bb90445ed0d433d2fea93eec48b2f315a64d8 Mon Sep 17 00:00:00 2001
From: Brian Moe <brian.moe@ligo.org>
Date: Thu, 9 Jul 2009 17:22:04 -0500
Subject: [PATCH] Added alerts to Test group. Man there's some ugly hackage in
 there. In particular, the jabber pubsub not for CBC/MBTAOnline is
 cbc_mbta_online when it should be cbc_mbtaonline.

---
 gracedb/alert.py | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/gracedb/alert.py b/gracedb/alert.py
index 7da51db48..ee67f54d8 100644
--- a/gracedb/alert.py
+++ b/gracedb/alert.py
@@ -27,19 +27,25 @@ def issueEmailAlert(event, location):
 
 def issueXMPPAlert(event, location):
     # XXX awful!
-    if event.analysisType != 'MBTA':
+    if event.analysisType != 'MBTA' and event.group.name != 'Test':
         return
 
     env = {}
-    pythonpath = ":".join(sys.path)
-    env["PYTHONPATH"] = pythonpath
+    env["PYTHONPATH"] = ":".join(sys.path)
+
+    if event.analysisType == 'MBTA' and event.group.name == 'CBC':
+        nodename = "cbc_mbta_online"
+    else:
+        nodename = "%s_%s"% (event.group.name, event.get_analysisType_display())
+        nodenae = nodename.lower()
+
     null = open('/dev/null','w')
     p = Popen(
         ["lvalert_send",
          "--username=gracedb",
          "--password=w4k3upal1ve",
          "--file=-",
-         "--node=cbc_mbta_online"
+         "--node=%s" % nodename,
         ],
         executable="/opt/lscsoft/glue/bin/lvalert_send",
         stdin=PIPE,
-- 
GitLab