[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r12326: Merged ioerror's patch. (weather/trunk)



Author: pde
Date: 2007-11-02 02:06:40 -0400 (Fri, 02 Nov 2007)
New Revision: 12326

Modified:
   weather/trunk/README
   weather/trunk/config.py
   weather/trunk/poll.py
   weather/trunk/weather.py
Log:
Merged ioerror's patch.



Modified: weather/trunk/README
===================================================================
--- weather/trunk/README	2007-11-02 04:31:50 UTC (rev 12325)
+++ weather/trunk/README	2007-11-02 06:06:40 UTC (rev 12326)
@@ -13,6 +13,9 @@
 python-webpy
 tor
 
+If you're running this in apache, you'll also need:
+python-flup
+
 /etc/tor/torrc should be configured to enable the control port and insist upon
 authentication.  Plaintext control port authentication information
 should be placed in config.py, along with a publicly addressable url prefix
@@ -23,3 +26,9 @@
 it is absolutely essential to backup subscriptions.gdbm properly, and
 unsubscriptions.gdbm is pretty important too (though the code could be modified
 to recover from its loss).
+
+By default these files are stored in /var/lib/torweather/
+
+Create this like so:
+mkdir -p /var/lib/torweather && chown www-data:www-data /var/lib/torweather
+

Modified: weather/trunk/config.py
===================================================================
--- weather/trunk/config.py	2007-11-02 04:31:50 UTC (rev 12325)
+++ weather/trunk/config.py	2007-11-02 06:06:40 UTC (rev 12326)
@@ -1,12 +1,13 @@
 #!/usr/bin/env python2.5
 
-authenticator = ""  # customise this
+authenticator = "frogzify"  # customise this
 
-#URLbase = "http://weather.torproject.org";
-URLbase = "http://ip-adress:port";
+URLbase = "http://weather.torproject.org";
 
-weather_email = "no-reply@xxxxxxxxxxxxxx"
+weather_storage = "/var/lib/torweather/"
 
+weather_email = "tor-ops@xxxxxxxxxxxxxx"
+
 # these respond to pings (for now!) and are geographically dispersed
 
 ping_targets = ["google.com", "telstra.com.au", "yahoo.co.uk"]

Modified: weather/trunk/poll.py
===================================================================
--- weather/trunk/poll.py	2007-11-02 04:31:50 UTC (rev 12325)
+++ weather/trunk/poll.py	2007-11-02 06:06:40 UTC (rev 12326)
@@ -12,13 +12,13 @@
 import TorCtl.TorCtl as TorCtl
 
 from config import authenticator, URLbase, weather_email, failure_threshold
-from config import poll_period, ping_targets
+from config import poll_period, ping_targets, weather_storage
 from weather import parse_subscriptions
 
 debug = 0
 
 
-debugfile = open("torctl-debug","w")
+debugfile = open(weather_storage + "/torctl-debug","w")
 class TorPing:
   "Check to see if various tor nodes respond to SSL hanshakes"
   def __init__(self, control_host = "127.0.0.1", control_port = 9051):
@@ -113,10 +113,10 @@
   "This thread sits around, checking to see if tor nodes are up."
 
   def __init__(self, subscriptions, lock):
-    #self.subscriptions = gdbm.open("subscriptions")
+    #self.subscriptions = gdbm.open(weather_storage + "/subscriptions")
     self.gdbm_lock = lock
     self.subscriptions = subscriptions
-    self.failure_counts = gdbm.open("failures.gdbm", "cs") 
+    self.failure_counts = gdbm.open(weather_storage + "/failures.gdbm", "cs") 
     self.failure_counts.reorganize() # just in case
     if debug:
       print "failure counts"

Modified: weather/trunk/weather.py
===================================================================
--- weather/trunk/weather.py	2007-11-02 04:31:50 UTC (rev 12325)
+++ weather/trunk/weather.py	2007-11-02 06:06:40 UTC (rev 12326)
@@ -11,7 +11,7 @@
 import signal # does this help with keyboard interrupts?
 import base64
 
-from config import URLbase, weather_email
+from config import URLbase, weather_email, weather_storage
 
 debug = 0
 dummy_testing = 0
@@ -32,15 +32,15 @@
 
   gdbm_lock = threading.RLock()
 
-  requests = gdbm.open("requests.gdbm","cs")
+  requests = gdbm.open(weather_storage + "/requests.gdbm","cs")
   print "requests:"
   for s in requests.keys():
     print s, requests[s]
-  subscriptions = gdbm.open("subscriptions.gdbm","cs")
+  subscriptions = gdbm.open(weather_storage + "/subscriptions.gdbm","cs")
   print "subscriptions:"
   for s in subscriptions.keys():
     print s, '"'+subscriptions[s]+'"'
-  unsubscriptions = gdbm.open("unsubscriptions.gdbm","cs")
+  unsubscriptions = gdbm.open(weather_storage + "/unsubscriptions.gdbm","cs")
   print "unsubscriptions:"
   for s in unsubscriptions.keys():
     print s, unsubscriptions[s]
@@ -124,7 +124,7 @@
       print "Sorry, I'm not subscribing you twice."
     else:
       # Leak no information about who is subscribed
-      print "Thankyou for using Tor Weather.  A confirmation request has been sent to", i.email + "."
+      print "Thank you for using Tor Weather.  A confirmation request has been sent to", i.email + "."
 
   # node ids are 40 digit hexidecimal numbers
   node_okay = re.compile("(0x)?[a-fA-F0-9]{40}\Z")