[mod] small opti, getting domain list can be slow

This commit is contained in:
Laurent Peuch 2016-10-30 05:42:49 +01:00
parent 02b5ea62fe
commit 8b24ab73c2

View file

@ -90,9 +90,10 @@ def certificate_status(auth, domain_list, full=False):
domain_list = yunohost.domain.domain_list(auth)['domains']
# Else, validate that yunohost knows the domains given
else:
yunohost_domains_list = yunohost.domain.domain_list(auth)['domains']
for domain in domain_list:
# Is it in Yunohost domain list ?
if domain not in yunohost.domain.domain_list(auth)['domains']:
if domain not in yunohost_domains_list:
raise MoulinetteError(errno.EINVAL, m18n.n('certmanager_domain_unknown', domain=domain))
# Get status for each domain, and prepare display using tabulate