for serverid in d["servers-responding"]]
sharemap = {}
for (shareid, serverids) in d["sharemap"].items():
- sharemap[shareid] = [base32.b2a(serverid) for serverid in serverids]
+ sharemap[shareid] = [idlib.nodeid_b2a(serverid)
+ for serverid in serverids]
r["sharemap"] = sharemap
r["count-wrong-shares"] = d["count-wrong-shares"]
assert isinstance(s, (list, tuple))
return [html.escape(w) for w in s]
-class LiteralCheckerResults(rend.Page):
+ def want_json(self, ctx):
+ output = get_arg(inevow.IRequest(ctx), "output", "").lower()
+ if output.lower() == "json":
+ return True
+ return False
+
+class LiteralCheckerResults(rend.Page, ResultsBase):
docFactory = getxmlfile("literal-checker-results.xhtml")
def renderHTTP(self, ctx):
- t = get_arg(inevow.IRequest(ctx), "output", "")
- if t.lower() == "json":
+ if self.want_json(ctx):
return self.json(ctx)
return rend.Page.renderHTTP(self, ctx)
self.r = ICheckerResults(results)
def renderHTTP(self, ctx):
- t = get_arg(inevow.IRequest(ctx), "output", "")
- if t.lower() == "json":
+ if self.want_json(ctx):
return self.json(ctx)
return rend.Page.renderHTTP(self, ctx)
self.r = ICheckAndRepairResults(results)
def renderHTTP(self, ctx):
- t = get_arg(inevow.IRequest(ctx), "output", None)
- if t == "json":
+ if self.want_json(ctx):
return self.json(ctx)
return rend.Page.renderHTTP(self, ctx)
self.r = results
def renderHTTP(self, ctx):
- t = get_arg(inevow.IRequest(ctx), "output", None)
- if t == "json":
+ if self.want_json(ctx):
return self.json(ctx)
return rend.Page.renderHTTP(self, ctx)
data["count-objects-healthy"] = c["count-objects-healthy"]
data["count-objects-unhealthy"] = c["count-objects-unhealthy"]
data["count-corrupt-shares"] = c["count-corrupt-shares"]
- data["list-corrupt-shares"] = [ (idlib.b2a(serverid),
- idlib.b2a(storage_index),
+ data["list-corrupt-shares"] = [ (idlib.nodeid_b2a(serverid),
+ base32.b2a(storage_index),
shnum)
for (serverid, storage_index, shnum)
in self.r.get_corrupt_shares() ]
self.r = results
def renderHTTP(self, ctx):
- t = get_arg(inevow.IRequest(ctx), "output", None)
- if t == "json":
+ if self.want_json(ctx):
return self.json(ctx)
return rend.Page.renderHTTP(self, ctx)
data["count-corrupt-shares-pre-repair"] = c["count-corrupt-shares-pre-repair"]
data["count-corrupt-shares-post-repair"] = c["count-corrupt-shares-pre-repair"]
- data["list-corrupt-shares"] = [ (idlib.b2a(serverid),
- idlib.b2a(storage_index),
+ data["list-corrupt-shares"] = [ (idlib.nodeid_b2a(serverid),
+ base32.b2a(storage_index),
shnum)
for (serverid, storage_index, shnum)
in self.r.get_corrupt_shares() ]
- data["list-remaining-corrupt-shares"] = [ (idlib.b2a(serverid),
- idlib.b2a(storage_index),
+ data["list-remaining-corrupt-shares"] = [ (idlib.nodeid_b2a(serverid),
+ base32.b2a(storage_index),
shnum)
for (serverid, storage_index, shnum)
in self.r.get_remaining_corrupt_shares() ]
T.input(type="hidden", name="t", value="deep-check"),
T.input(type="hidden", name="return_to", value="."),
T.legend(class_="freeform-form-label")["Run a deep-check operation (EXPENSIVE)"],
- T.input(type="submit", value="Deep-Check"),
- " ",
+ T.div[
"Verify every bit? (EVEN MORE EXPENSIVE):",
T.input(type="checkbox", name="verify"),
+ ],
+ T.div["Repair any problems?: ",
+ T.input(type="checkbox", name="repair")],
+ T.div["Emit results in JSON format?: ",
+ T.input(type="checkbox", name="output", value="JSON")],
+
+ T.input(type="submit", value="Deep-Check"),
+
]]
forms.append(T.div(class_="freeform-form")[deep_check])