+
+ def check_backupdb(self, childpath):
+ if not self.options.backupdb:
+ return True, None
+ use_timestamps = not self.options["ignore-timestamps"]
+ bdb = self.options.backupdb
+ r = bdb.check_file(childpath, use_timestamps)
+
+ if not r.was_uploaded():
+ return True, r
+
+ if not r.should_check():
+ # the file was uploaded or checked recently, so we can just use
+ # it
+ return False, r
+
+ # we must check the file before using the results
+ filecap = r.was_uploaded()
+ self.verboseprint("checking %s" % filecap)
+ nodeurl = self.options['node-url']
+ checkurl = nodeurl + "uri/%s?t=check&output=JSON" % urllib.quote(filecap)
+ resp = do_http("POST", checkurl)
+ if resp.status != 200:
+ # can't check, so we must assume it's bad
+ return True, r
+
+ cr = simplejson.loads(resp.read())
+ healthy = cr["results"]["healthy"]
+ if not healthy:
+ # must upload
+ return True, r
+ # file is healthy, no need to upload
+ r.did_check_healthy(cr)
+ return False, r
+