mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Better handle case where diagnosis cache is missing
This commit is contained in:
parent
09bbd733b1
commit
16f6d500a3
2 changed files with 30 additions and 20 deletions
|
@ -158,6 +158,7 @@
|
|||
"diagnosis_found_warnings": "Found {warnings} item(s) that could be improved for {category}.",
|
||||
"diagnosis_everything_ok": "Everything looks good for {category}!",
|
||||
"diagnosis_failed": "Failed to fetch diagnosis result for category '{category}' : {error}",
|
||||
"diagnosis_no_cache": "No diagnosis cache yet for category '{category}'",
|
||||
"diagnosis_ip_connected_ipv4": "The server is connected to the Internet through IPv4 !",
|
||||
"diagnosis_ip_no_ipv4": "The server does not have a working IPv4.",
|
||||
"diagnosis_ip_connected_ipv6": "The server is connected to the Internet through IPv6 !",
|
||||
|
|
|
@ -61,11 +61,20 @@ def diagnosis_show(categories=[], issues=False, full=False, share=False):
|
|||
# Fetch all reports
|
||||
all_reports = []
|
||||
for category in categories:
|
||||
if not os.path.exists(Diagnoser.cache_file(category)):
|
||||
logger.warning(m18n.n("diagnosis_no_cache", category=category))
|
||||
report = {"id": category,
|
||||
"cached_for": -1,
|
||||
"timestamp": -1,
|
||||
"items": []}
|
||||
Diagnoser.i18n(report)
|
||||
else:
|
||||
try:
|
||||
report = Diagnoser.get_cached_report(category)
|
||||
except Exception as e:
|
||||
logger.error(m18n.n("diagnosis_failed", category=category, error=str(e)))
|
||||
else:
|
||||
continue
|
||||
|
||||
add_ignore_flag_to_issues(report)
|
||||
if not full:
|
||||
del report["timestamp"]
|
||||
|
|
Loading…
Add table
Reference in a new issue