servermap add-lease: fix the code that's supposed to catch remote IndexErrors, I forgot that they present as ServerFailures instead. This should stop the deluge of Incidents that occur when you do add-lease against 1.3.0 servers

This commit is contained in:
Brian Warner 2009-02-27 01:04:26 -07:00
parent 8c3013c4f7
commit 99ebf6eaf5
1 changed files with 3 additions and 3 deletions

View File

@ -6,7 +6,7 @@ from twisted.internet import defer
from twisted.python import failure from twisted.python import failure
from foolscap import DeadReferenceError from foolscap import DeadReferenceError
from foolscap.eventual import eventually from foolscap.eventual import eventually
from allmydata.util import base32, hashutil, idlib, log from allmydata.util import base32, hashutil, idlib, log, rrefutil
from allmydata.storage.server import si_b2a from allmydata.storage.server import si_b2a
from allmydata.interfaces import IServermapUpdaterStatus from allmydata.interfaces import IServermapUpdaterStatus
from pycryptopp.publickey import rsa from pycryptopp.publickey import rsa
@ -543,12 +543,12 @@ class ServermapUpdater:
cancel_secret = self._node.get_cancel_secret(peerid) cancel_secret = self._node.get_cancel_secret(peerid)
d2 = ss.callRemote("add_lease", storage_index, d2 = ss.callRemote("add_lease", storage_index,
renew_secret, cancel_secret) renew_secret, cancel_secret)
dl = defer.DeferredList([d, d2]) dl = defer.DeferredList([d, d2], consumeErrors=True)
def _done(res): def _done(res):
[(readv_success, readv_result), [(readv_success, readv_result),
(addlease_success, addlease_result)] = res (addlease_success, addlease_result)] = res
if (not addlease_success and if (not addlease_success and
not addlease_result.check(IndexError)): not rrefutil.check_remote(addlease_result, IndexError)):
# tahoe 1.3.0 raised IndexError on non-existant buckets, # tahoe 1.3.0 raised IndexError on non-existant buckets,
# which we ignore. Unfortunately tahoe <1.3.0 had a bug # which we ignore. Unfortunately tahoe <1.3.0 had a bug
# and raised KeyError, which we report. # and raised KeyError, which we report.