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

[or-cvs] r19709: {arm} Removed '--path-to-torctl' startup option. (in arm/trunk: . interface)



Author: atagar
Date: 2009-06-10 20:55:29 -0400 (Wed, 10 Jun 2009)
New Revision: 19709

Modified:
   arm/trunk/arm.py
   arm/trunk/interface/bandwidthPanel.py
   arm/trunk/interface/controller.py
   arm/trunk/interface/logPanel.py
Log:
Removed '--path-to-torctl' startup option.



Modified: arm/trunk/arm.py
===================================================================
--- arm/trunk/arm.py	2009-06-11 00:48:06 UTC (rev 19708)
+++ arm/trunk/arm.py	2009-06-11 00:55:29 UTC (rev 19709)
@@ -14,6 +14,12 @@
 import getpass
 import binascii
 
+from TorCtl import TorCtl
+from TorCtl import TorUtil
+
+from interface import controller
+from interface import logPanel
+
 DEFAULT_CONTROL_ADDR = "127.0.0.1"
 DEFAULT_CONTROL_PORT = 9051
 DEFAULT_AUTH_COOKIE = os.path.expanduser("~/.tor/control_auth_cookie") # TODO: Check if this is valid for macs
@@ -21,13 +27,6 @@
 
 NO_AUTH, COOKIE_AUTH, PASSWORD_AUTH = range(3) # enums for authentication type
 
-EVENT_LISTING = """        d DEBUG     a ADDRMAP       l NEWDESC         u AUTHDIR_NEWDESCS
-        i INFO      b BW            m NS              v CLIENTS_SEEN
-        n NOTICE    c CIRC          o ORCONN          x STATUS_GENERAL
-        w WARN      f DESCCHANGED   s STREAM          y STATUS_CLIENT
-        e ERR       g GUARD         t STREAM_BW       z STATUS_SERVER
-        Aliases:    A All Events    U Unknown Events  R Runlevels (dinwe)"""
-
 HELP_TEXT = """Usage arm [OPTION]
 Terminal Tor relay status monitor.
 
@@ -38,14 +37,13 @@
                                     without terminal echo if not provided
   -e, --event=[EVENT FLAGS]       event types in message log  (default: %s)
 %s
-  --path-to-torctl=[PATH]         location of TorCtl if not in Python path
   -h, --help                      presents this help
 
 Example:
 arm -c                  authenticate using the default cookie
 arm -i 1643 -p          prompt for password using control port 1643
 arm -e=we -p=nemesis    use password 'nemesis' with 'WARN'/'ERR' events
-""" % (DEFAULT_CONTROL_ADDR, DEFAULT_CONTROL_PORT, DEFAULT_AUTH_COOKIE, DEFAULT_LOGGED_EVENTS, EVENT_LISTING)
+""" % (DEFAULT_CONTROL_ADDR, DEFAULT_CONTROL_PORT, DEFAULT_AUTH_COOKIE, DEFAULT_LOGGED_EVENTS, logPanel.EVENT_LISTING)
 
 EVENT_LISTING = """        d DEBUG     a ADDRMAP       l NEWDESC         u AUTHDIR_NEWDESCS
         i INFO      b BW            m NS              v CLIENTS_SEEN
@@ -64,7 +62,6 @@
     self.authCookieLoc = DEFAULT_AUTH_COOKIE    # location of authentication cookie
     self.authPassword = ""                      # authentication password
     self.loggedEvents = DEFAULT_LOGGED_EVENTS   # flags for event types in message log
-    self.pathAppend = ""                        # additions to Python path
     self.isValid = True                         # determines if the program should run
     self.printHelp = False                      # prints help then quits
     self._parseArgs(args)
@@ -129,10 +126,6 @@
       if args[0].startswith("-e="): self.loggedEvents = args[0][3:]
       else: self.loggedEvents = args[0][8:]
       self._parseArgs(args[1:])
-    elif args[0].startswith("--path-to-torctl="):
-      # appends location to Python path (to help find TorCtl)
-      self.pathAppend = args[0][17:]
-      self._parseArgs(args[1:])
     elif args[0] == "-h" or args[0] == "--help":
       self.printHelp = True
       self._parseArgs(args[1:])
@@ -173,21 +166,6 @@
     print HELP_TEXT
     sys.exit()
   
-  # appends appending to Python path
-  if input.pathAppend:
-    sys.path.append(input.pathAppend)
-  
-  # tries to load TorCtl
-  try:
-    from TorCtl import TorCtl
-    from TorCtl import TorUtil
-    
-    from interface import controller
-    from interface import logPanel
-  except ImportError:
-    print "Unable to load TorCtl (see readme for instructions)"
-    sys.exit()
-  
   # validates that cookie authentication path exists
   if input.authType == COOKIE_AUTH and not os.path.exists(input.authCookieLoc):
     print "Authentication cookie doesn't exist: %s" % input.authCookieLoc

Modified: arm/trunk/interface/bandwidthPanel.py
===================================================================
--- arm/trunk/interface/bandwidthPanel.py	2009-06-11 00:48:06 UTC (rev 19708)
+++ arm/trunk/interface/bandwidthPanel.py	2009-06-11 00:55:29 UTC (rev 19709)
@@ -22,7 +22,9 @@
   
   def __init__(self, lock, conn):
     TorCtl.PostEventListener.__init__(self)
-    self.isAccounting = conn.get_info('accounting/enabled')['accounting/enabled'] == '1'
+    if conn: self.isAccounting = conn.get_info('accounting/enabled')['accounting/enabled'] == '1'
+    else: self.isAccounting = False
+    
     height = 12 if self.isAccounting else 9
     util.Panel.__init__(self, lock, height)
     

Modified: arm/trunk/interface/controller.py
===================================================================
--- arm/trunk/interface/controller.py	2009-06-11 00:48:06 UTC (rev 19708)
+++ arm/trunk/interface/controller.py	2009-06-11 00:55:29 UTC (rev 19709)
@@ -11,7 +11,6 @@
 from threading import RLock
 from TorCtl import TorCtl
 
-import arm
 import util
 import staticPanel
 import bandwidthPanel
@@ -187,7 +186,7 @@
         bwPanel.clear()
         bwPanel.addstr(0, 0, "Event Types:", util.LABEL_ATTR)
         lineNum = 1
-        for line in arm.EVENT_LISTING.split("\n"):
+        for line in logPanel.EVENT_LISTING.split("\n"):
           line = line.strip()
           bwPanel.addstr(lineNum, 0, line[:x - 1])
           lineNum += 1

Modified: arm/trunk/interface/logPanel.py
===================================================================
--- arm/trunk/interface/logPanel.py	2009-06-11 00:48:06 UTC (rev 19708)
+++ arm/trunk/interface/logPanel.py	2009-06-11 00:55:29 UTC (rev 19709)
@@ -18,6 +18,13 @@
   "n": "NOTICE",  "c": "CIRC",        "o": "ORCONN",    "x": "STATUS_GENERAL",
   "w": "WARN",    "f": "DESCCHANGED", "s": "STREAM",    "y": "STATUS_CLIENT",
   "e": "ERR",     "g": "GUARD",       "t": "STREAM_BW", "z": "STATUS_SERVER"}
+
+EVENT_LISTING = """        d DEBUG     a ADDRMAP       l NEWDESC         u AUTHDIR_NEWDESCS
+        i INFO      b BW            m NS              v CLIENTS_SEEN
+        n NOTICE    c CIRC          o ORCONN          x STATUS_GENERAL
+        w WARN      f DESCCHANGED   s STREAM          y STATUS_CLIENT
+        e ERR       g GUARD         t STREAM_BW       z STATUS_SERVER
+        Aliases:    A All Events    U Unknown Events  R Runlevels (dinwe)"""
   
 def expandEvents(eventAbbr):
   """