From b75d6695261020e52d87363012e5b8b9ad9e900c Mon Sep 17 00:00:00 2001
From: Stephen Soltesz <soltesz@cs.princeton.edu>
Date: Fri, 2 Nov 2007 21:17:48 +0000
Subject: [PATCH] Changes necessary for the new operating environment. 
 rt_tickets, returns empty string to signify error, and diagnose.py exits on
 failure.  Can't return None, since this is seen specially by the pickle
 class.  That's a bug.

---
 diagnose.py | 3 +++
 mailer.py   | 2 +-
 rt.py       | 4 +++-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/diagnose.py b/diagnose.py
index 1002118..7668e88 100755
--- a/diagnose.py
+++ b/diagnose.py
@@ -187,6 +187,9 @@ def main():
 	#######  RT tickets    #########################################
 	t = soltesz.MyTimer()
 	ad_dbTickets = soltesz.if_cached_else_refresh(config.cachert, config.refresh, "ad_dbTickets", rt.rt_tickets)
+	if ad_dbTickets == "":
+		print "ad_dbTickets failed..."
+		sys.exit(1)
 	print "Getting tickets from RT took: %f sec" % t.diff() ; del t
 
 	logger.info('Start Merge/RT/Diagnose threads')
diff --git a/mailer.py b/mailer.py
index d8e9b53..c6a1f4e 100755
--- a/mailer.py
+++ b/mailer.py
@@ -27,7 +27,7 @@ def reformat_for_rt(text):
 		
 
 def _setupRTenvironment():
-	os.environ['PATH'] = os.environ['PATH'] + ":/home/soltesz/rpm/opt/rt3/bin/"
+	os.environ['PATH'] = os.environ['PATH'] + ":/home/soltesz/local/bin/"
 	os.environ['RTSERVER'] = "https://rt.planet-lab.org/"
 	os.environ['RTUSER']   = "monitor"
 	os.environ['RTPASSWD'] = "ssorcmor"
diff --git a/rt.py b/rt.py
index c35a062..5127ba0 100644
--- a/rt.py
+++ b/rt.py
@@ -14,7 +14,7 @@ from threading import *
 # TODO: merge the RT mailer from mailer.py into this file.
 
 # RT database access constants file
-RT_DB_CONSTANTS_PATH='/etc/planetlab/rt_db'
+RT_DB_CONSTANTS_PATH='rt_db'
 
 #Logging
 logger = logging.getLogger("monitor")
@@ -91,6 +91,8 @@ def open_rt_db():
 
 def rt_tickets():
 	db = open_rt_db()
+	if db == -1:
+		return ""
 #	sql = """SELECT distinct Tk.id, Tk.Status, Tk.Subject
 #			 FROM Tickets AS Tk
 #			 JOIN Transactions AS Tr ON Tk.id=Tr.ObjectId
-- 
2.47.0