repairer: raise a better exception when faced with a readonly filenode. Still
authorBrian Warner <warner@lothar.com>
Fri, 26 Jun 2009 06:32:30 +0000 (23:32 -0700)
committerBrian Warner <warner@lothar.com>
Fri, 26 Jun 2009 06:32:30 +0000 (23:32 -0700)
produces an error, though.

src/allmydata/mutable/repairer.py

index b7d49bcde04c1b0f965254fa3bd77cbbd94f7fbc..d04e3c693fde529cedeb66f7be93ba1fc555ce9e 100644 (file)
@@ -11,6 +11,9 @@ class RepairResults:
     def to_string(self):
         return ""
 
+class RepairRequiresWritecapError(Exception):
+    """Repair currently requires a writecap."""
+    
 class MustForceRepairError(Exception):
     pass
 
@@ -86,7 +89,8 @@ class Repairer:
         # available, to avoid the extra roundtrip that would occur if we,
         # say, added an smap.get_privkey() method.
 
-        assert self.node.get_writekey() # repair currently requires a writecap
+        if not self.node.get_writekey():
+            raise RepairRequiresWritecapError("Sorry, repair currently requires a writecap, to set the write-enabler properly.")
 
         best_version = smap.best_recoverable_version()
         d = self.node.download_version(smap, best_version, fetch_privkey=True)