mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Try to not have weird warnings if no diagnosis ran yet...
This commit is contained in:
parent
97199d1961
commit
65c87d55df
2 changed files with 12 additions and 12 deletions
|
@ -103,10 +103,16 @@ def certificate_status(domain_list, full=False):
|
|||
if not full:
|
||||
del status["subject"]
|
||||
del status["CA_name"]
|
||||
del status["ACME_eligible"]
|
||||
status["CA_type"] = status["CA_type"]["verbose"]
|
||||
status["summary"] = status["summary"]["verbose"]
|
||||
|
||||
if full:
|
||||
try:
|
||||
_check_domain_is_ready_for_ACME(domain)
|
||||
status["ACME_eligible"] = True
|
||||
except:
|
||||
status["ACME_eligible"] = False
|
||||
|
||||
del status["domain"]
|
||||
certificates[domain] = status
|
||||
|
||||
|
@ -700,12 +706,6 @@ def _get_status(domain):
|
|||
"verbose": "Unknown?",
|
||||
}
|
||||
|
||||
try:
|
||||
_check_domain_is_ready_for_ACME(domain)
|
||||
ACME_eligible = True
|
||||
except:
|
||||
ACME_eligible = False
|
||||
|
||||
return {
|
||||
"domain": domain,
|
||||
"subject": cert_subject,
|
||||
|
@ -713,7 +713,6 @@ def _get_status(domain):
|
|||
"CA_type": CA_type,
|
||||
"validity": days_remaining,
|
||||
"summary": status_summary,
|
||||
"ACME_eligible": ACME_eligible
|
||||
}
|
||||
|
||||
#
|
||||
|
@ -791,8 +790,8 @@ def _backup_current_cert(domain):
|
|||
|
||||
def _check_domain_is_ready_for_ACME(domain):
|
||||
|
||||
dnsrecords = Diagnoser.get_cached_report("dnsrecords", item={"domain": domain, "category": "basic"}) or {}
|
||||
httpreachable = Diagnoser.get_cached_report("web", item={"domain": domain}) or {}
|
||||
dnsrecords = Diagnoser.get_cached_report("dnsrecords", item={"domain": domain, "category": "basic"}, warn_if_no_cache=False) or {}
|
||||
httpreachable = Diagnoser.get_cached_report("web", item={"domain": domain}, warn_if_no_cache=False) or {}
|
||||
|
||||
if not dnsrecords or not httpreachable:
|
||||
raise YunohostError('certmanager_domain_not_diagnosed_yet', domain=domain)
|
||||
|
|
|
@ -427,10 +427,11 @@ class Diagnoser():
|
|||
return os.path.join(DIAGNOSIS_CACHE, "%s.json" % id_)
|
||||
|
||||
@staticmethod
|
||||
def get_cached_report(id_, item=None):
|
||||
def get_cached_report(id_, item=None, warn_if_no_cache=True):
|
||||
cache_file = Diagnoser.cache_file(id_)
|
||||
if not os.path.exists(cache_file):
|
||||
logger.warning(m18n.n("diagnosis_no_cache", category=id_))
|
||||
if warn_if_no_cache:
|
||||
logger.warning(m18n.n("diagnosis_no_cache", category=id_))
|
||||
report = {"id": id_,
|
||||
"cached_for": -1,
|
||||
"timestamp": -1,
|
||||
|
|
Loading…
Add table
Reference in a new issue