From d0f80579a502e36f8dda7e0c697435e8a66e413f Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Thu, 25 Jun 2009 23:32:30 -0700 Subject: [PATCH] repairer: raise a better exception when faced with a readonly filenode. Still produces an error, though. --- src/allmydata/mutable/repairer.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/allmydata/mutable/repairer.py b/src/allmydata/mutable/repairer.py index b7d49bcd..d04e3c69 100644 --- a/src/allmydata/mutable/repairer.py +++ b/src/allmydata/mutable/repairer.py @@ -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) -- 2.45.2