Skip to content

Commit

Permalink
Merge pull request #626 from midoks/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
midoks authored Oct 2, 2024
2 parents da2d0fd + 02f14b2 commit c95efcd
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion class/core/cert_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1383,6 +1383,17 @@ def renewCertTo(self, domains, auth_type, auth_to, index=None):
writeLog("-" * 70)
return cert

def checkDomainIsExsits(self, domain):
if mw.M('domain').where("name=?", (domain,)).count() > 0:
return True

if mw.M('sites').where("name=?", (domain,)).count() > 0:
return True

if mw.M('binding').where("name=?", (domain,)).count() > 0:
return True
return False

def renewCert(self, index):
writeLog("", "wb+")
# self.D('renew_cert', index)
Expand Down Expand Up @@ -1429,6 +1440,8 @@ def renewCert(self, index):
for domain in self.__config['orders'][i]['domains']:
if domain.find('*') != -1:
break


if not mw.M('domain').where("name=?", (domain,)).count() and not mw.M('binding').where("domain=?", domain).count():
auth_to = None
msg = "|-跳过被删除的域名: {}".format(
Expand All @@ -1439,6 +1452,14 @@ def renewCert(self, index):

self.__config['orders'][i]['auth_to'] = auth_to

auth_to = True
for domain in self.__config['orders'][i]['domains']:
if not self.checkDomainIsExsits(domain):
auth_to = False
msg = "|-跳过被删除的域名: {}!".format(self.__config['orders'][i]['domains'])
writeLog(msg)
if not auth_to:
continue
# 是否到了允许重试的时间
if 'next_retry_time' in self.__config['orders'][i]:
timeout = self.__config['orders'][i][
Expand All @@ -1452,7 +1473,7 @@ def renewCert(self, index):
# 是否到了最大重试次数
if 'retry_count' in self.__config['orders'][i]:
if self.__config['orders'][i]['retry_count'] >= 100:
msg = '|-本次跳过域名:{},因连续10次续签失败,不再续签此证书(可尝试手动续签此证书,成功后错误次数将被重置)'.format(
msg = '|-本次跳过域名:{},因连续100次续签失败,不再续签此证书(可尝试手动续签此证书,成功后错误次数将被重置)'.format(
self.__config['orders'][i]['domains'])
writeLog(msg)
continue
Expand Down

0 comments on commit c95efcd

Please sign in to comment.