From e95d29f446d06eced315a3087fc9e105a30b20bd Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Mon, 20 Jan 2025 11:53:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=85=BE=E8=AE=AFclb?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E6=89=A7=E8=A1=8C=E4=BC=9A=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugin/deploy-to-clb/index.ts | 49 ++++++++++--------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/deploy-to-clb/index.ts b/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/deploy-to-clb/index.ts index 4177c968..ad80aa1a 100644 --- a/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/deploy-to-clb/index.ts +++ b/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/deploy-to-clb/index.ts @@ -135,32 +135,35 @@ export class DeployCertToTencentCLB extends AbstractTaskPlugin { const domains = Array.isArray(this.domain) ? this.domain : [this.domain]; for (const domain of domains) { this.logger.info(`开始更新域名证书:${domain},请确保已经开启了sni`); - const lastCertId = await this.getCertIdFromProps(client, domain); + // const lastCertId = await this.getCertIdFromProps(client, domain); await this.updateByDomainAttr(client, domain); - const checkDeployed = async (wait = 5) => { - await this.ctx.utils.sleep(wait * 1000); - this.logger.info(`等待${wait}秒`); - const newCertId = await this.getCertIdFromProps(client, domain); - this.logger.info(`oldCertId:${lastCertId} , newCertId:${newCertId}`); - if ((lastCertId && newCertId === lastCertId) || (!lastCertId && !newCertId)) { - return false; - } - this.logger.info('腾讯云证书ID:', newCertId); - return true; - }; - let count = 0; - while (true) { - count++; - const res = await checkDeployed(5); - if (res) { - break; - } - if (count > 6) { - throw new Error('部署可能失败,请确认是否已开启sni'); - } - } + this.logger.info(`设置腾讯云CLB证书(sni)成功:loadBalancerId:${this.loadBalancerId},listenerId:${this.listenerId},domain:${domain}`); + + // 不要做检查,相同的证书,不会生成新的证书id + // const checkDeployed = async (wait = 5) => { + // await this.ctx.utils.sleep(wait * 1000); + // this.logger.info(`等待${wait}秒`); + // const newCertId = await this.getCertIdFromProps(client, domain); + // this.logger.info(`oldCertId:${lastCertId} , newCertId:${newCertId}`); + // if ((lastCertId && newCertId === lastCertId) || (!lastCertId && !newCertId)) { + // return false; + // } + // this.logger.info('腾讯云证书ID:', newCertId); + // return true; + // }; + // let count = 0; + // while (true) { + // count++; + // const res = await checkDeployed(5); + // if (res) { + // break; + // } + // if (count > 6) { + // this.logger.warn('等待超时,可能证书未部署成功'); + // } + // } } }