Wrap the report with meta infos

This commit is contained in:
Alexandre Aubin 2018-08-30 14:05:48 +00:00
parent f11206c0fa
commit 12df96f33e
2 changed files with 4 additions and 4 deletions

View file

@ -38,7 +38,6 @@ class IPDiagnoser(Diagnoser):
report = ("SUCCESS", "diagnosis_network_connected_ipv6", {}) if ipv6 \
else ("WARNING", "diagnosis_network_no_ipv6", {}))
def get_public_ip(self, protocol=4):
if protocol == 4:

View file

@ -110,13 +110,14 @@ class Diagnoser():
def report(self):
print(self.cached_time_ago())
if self.args.get("force", False) or self.cached_time_ago() < self.cache_duration:
self.logger_debug("Using cached report from %s" % self.cache_file)
return self.get_cached_report()
new_report = list(self.run())
new_report = { "id": self.id_,
"cached_for": self.cache_duration,
"reports": list(self.run())
}
# TODO / FIXME : should handle the case where we only did a partial diagnosis
self.logger_debug("Updating cache %s" % self.cache_file)