commit 6b27a91b54d6718f64c58e78e7ba6e0b2581291d
Author: Nick Mathewson <nickm(a)torproject.org>
Date: Mon Dec 29 10:46:07 2014 -0500
Actually, when we're told to configure, move the old 'nodes' dir
This makes me happier than just removing it, and shouldn't kill too
many people's hard drives.
---
lib/chutney/TorNet.py | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/lib/chutney/TorNet.py b/lib/chutney/TorNet.py
index 838d36f..4d365ad 100644
--- a/lib/chutney/TorNet.py
+++ b/lib/chutney/TorNet.py
@@ -749,12 +749,28 @@ class Network(object):
self._nextnodenum += 1
self._nodes.append(n)
+ def move_aside_nodes(self):
+ nodesdir = os.path.join(os.getcwd(),'net','nodes')
+
+ if not os.path.exists(nodesdir):
+ return
+
+ newdir = newdirbase = "%s.%d" % (nodesdir, time.time())
+ i = 0
+ while os.path.exists(newdir):
+ i += 1
+ newdir = "%s.%d" %(newdirbase, i)
+
+ print ("NOTE: renaming %r to %r"%(nodesdir, newdir))
+ os.rename(nodesdir, newdir)
+
def _checkConfig(self):
for n in self._nodes:
n.getBuilder().checkConfig(self)
def configure(self):
- shutil.rmtree(os.path.join(os.getcwd(),'net','nodes'),ignore_errors=True)
+ # shutil.rmtree(os.path.join(os.getcwd(),'net','nodes'),ignore_errors=True)
+ self.move_aside_nodes()
network = self
altauthlines = []
bridgelines = []