d.addCallback(lambda ign:
c0.upload(upload.Data("literal", convergence="")))
d.addCallback(_stash_uri, "small")
+ d.addCallback(lambda ign: c0.create_immutable_dirnode({}))
+ d.addCallback(_stash_mutable_uri, "smalldir")
def _compute_fileurls(ignored):
self.fileurls = {}
self.failUnless(r["results"]["healthy"])
d.addCallback(_got_json_small)
+ d.addCallback(self.CHECK, "smalldir", "t=check")
+ def _got_html_smalldir(res):
+ self.failUnless("Literal files are always healthy" in res, res)
+ self.failIf("Not Healthy" in res, res)
+ d.addCallback(_got_html_smalldir)
+ d.addCallback(self.CHECK, "smalldir", "t=check&output=json")
+ def _got_json_smalldir(res):
+ r = simplejson.loads(res)
+ self.failUnlessEqual(r["storage-index"], "")
+ self.failUnless(r["results"]["healthy"])
+ d.addCallback(_got_json_smalldir)
+
d.addCallback(self.CHECK, "sick", "t=check")
def _got_html_sick(res):
self.failUnless("Not Healthy" in res, res)
from allmydata.web.filenode import ReplaceMeMixin, \
FileNodeHandler, PlaceHolderNodeHandler
from allmydata.web.check_results import CheckResults, \
- CheckAndRepairResults, DeepCheckResults, DeepCheckAndRepairResults
+ CheckAndRepairResults, DeepCheckResults, DeepCheckAndRepairResults, \
+ LiteralCheckResults
from allmydata.web.info import MoreInfo
from allmydata.web.operations import ReloadMixin
from allmydata.web.check_results import json_check_results, \
d.addCallback(lambda res: "thing renamed")
return d
+ def _maybe_literal(self, res, Results_Class):
+ if res:
+ return Results_Class(self.client, res)
+ return LiteralCheckResults(self.client)
+
def _POST_check(self, req):
# check this directory
verify = boolean_of_arg(get_arg(req, "verify", "false"))
add_lease = boolean_of_arg(get_arg(req, "add-lease", "false"))
if repair:
d = self.node.check_and_repair(Monitor(), verify, add_lease)
- d.addCallback(lambda res: CheckAndRepairResults(self.client, res))
+ d.addCallback(self._maybe_literal, CheckAndRepairResults)
else:
d = self.node.check(Monitor(), verify, add_lease)
- d.addCallback(lambda res: CheckResults(self.client, res))
+ d.addCallback(self._maybe_literal, CheckResults)
return d
def _start_operation(self, monitor, renderer, ctx):
from allmydata.interfaces import ExistingChildError, CannotPackUnknownNodeError
from allmydata.monitor import Monitor
from allmydata.immutable.upload import FileHandle
-from allmydata.immutable.filenode import LiteralFileNode
from allmydata.unknown import UnknownNode
from allmydata.util import log, base32
d.addCallback(lambda res: url.URL.fromString(when_done))
return d
+ def _maybe_literal(self, res, Results_Class):
+ if res:
+ return Results_Class(self.client, res)
+ return LiteralCheckResults(self.client)
+
def _POST_check(self, req):
verify = boolean_of_arg(get_arg(req, "verify", "false"))
repair = boolean_of_arg(get_arg(req, "repair", "false"))
add_lease = boolean_of_arg(get_arg(req, "add-lease", "false"))
- if isinstance(self.node, LiteralFileNode):
- return defer.succeed(LiteralCheckResults(self.client))
if repair:
d = self.node.check_and_repair(Monitor(), verify, add_lease)
- d.addCallback(lambda res: CheckAndRepairResults(self.client, res))
+ d.addCallback(self._maybe_literal, CheckAndRepairResults)
else:
d = self.node.check(Monitor(), verify, add_lease)
- d.addCallback(lambda res: CheckResults(self.client, res))
+ d.addCallback(self._maybe_literal, CheckResults)
return d
def render_DELETE(self, ctx):