[or-cvs] r24012: {arm} Centralizing arm resources in ~/.arm (suggested by Sebastian (in arm/trunk: . src)

Damian Johnson atagar1 at gmail.com
Sat Jan 1 05:56:25 UTC 2011


Author: atagar
Date: 2011-01-01 05:56:25 +0000 (Sat, 01 Jan 2011)
New Revision: 24012

Modified:
   arm/trunk/armrc.sample
   arm/trunk/src/starter.py
Log:
Centralizing arm resources in ~/.arm (suggested by Sebastian and partly thanks to feedback from rransom)



Modified: arm/trunk/armrc.sample
===================================================================
--- arm/trunk/armrc.sample	2011-01-01 01:58:19 UTC (rev 24011)
+++ arm/trunk/armrc.sample	2011-01-01 05:56:25 UTC (rev 24012)
@@ -1,9 +1,10 @@
-# startup options
+# Startup options
 startup.controlPassword
 startup.interface.ipAddress 127.0.0.1
 startup.interface.port 9051
 startup.blindModeEnabled false
 startup.events N3
+startup.dataDirectory ~/.arm
 
 # Seconds between querying information
 queries.resourceUsage.rate 5

Modified: arm/trunk/src/starter.py
===================================================================
--- arm/trunk/src/starter.py	2011-01-01 01:58:19 UTC (rev 24011)
+++ arm/trunk/src/starter.py	2011-01-01 05:56:25 UTC (rev 24012)
@@ -27,14 +27,14 @@
 import TorCtl.TorCtl
 import TorCtl.TorUtil
 
-DEFAULT_CONFIG = os.path.expanduser("~/.armrc")
+DEFAULT_CONFIG = os.path.expanduser("~/.arm/armrc")
 CONFIG = {"startup.controlPassword": None,
           "startup.interface.ipAddress": "127.0.0.1",
           "startup.interface.port": 9051,
           "startup.blindModeEnabled": False,
           "startup.events": "N3",
+          "data.cache.path": "~/.arm/cache",
           "features.config.descriptions.enabled": True,
-          "features.config.descriptions.persistPath": "/tmp/arm/torConfigDescriptions.txt",
           "log.configDescriptions.readManPageSuccess": util.log.INFO,
           "log.configDescriptions.readManPageFailed": util.log.WARN,
           "log.configDescriptions.persistance.loadSuccess": util.log.INFO,
@@ -61,6 +61,9 @@
 arm -e we -c /tmp/cfg   use this configuration file with 'WARN'/'ERR' events
 """ % (CONFIG["startup.interface.ipAddress"], CONFIG["startup.interface.port"], DEFAULT_CONFIG, CONFIG["startup.events"], interface.logPanel.EVENT_LISTING)
 
+# filename used for cached tor config descriptions
+CONFIG_DESC_FILENAME = "torConfigDescriptions.txt"
+
 # messages related to loading the tor configuration descriptions
 DESC_LOAD_SUCCESS_MSG = "Loaded configuration descriptions from '%s' (runtime: %0.3f)"
 DESC_LOAD_FAILED_MSG = "Unable to load configuration descriptions (%s)"
@@ -108,8 +111,15 @@
   
   if CONFIG["features.config.descriptions.enabled"]:
     isConfigDescriptionsLoaded = False
-    descriptorPath = CONFIG["features.config.descriptions.persistPath"]
     
+    # determines the path where cached descriptions should be persisted (left
+    # undefined of arm caching is disabled)
+    cachePath, descriptorPath = CONFIG["data.cache.path"], None
+    
+    if cachePath:
+      if not cachePath.endswith("/"): cachePath += "/"
+      descriptorPath = os.path.expanduser(cachePath) + CONFIG_DESC_FILENAME
+    
     # attempts to load persisted configuration descriptions
     if descriptorPath:
       try:



More information about the tor-commits mailing list