超时设置文件名优化

This commit is contained in:
2026-07-18 20:42:26 +08:00
parent 521ad3b635
commit 1fd21ae128
3 changed files with 14 additions and 5 deletions
+9 -2
View File
@@ -184,7 +184,8 @@ class AcmeService:
# 写入临时凭据文件(certbot-dns-alicloud 需要 INI 格式)
creds_content = (
f"dns_alicloud_access_key = {creds.get('access_key', '')}\n"
f"dns_alicloud_access_key_secret = {creds.get('access_secret', '')}\n"
f"dns_alicloud_secret_key = {creds.get('access_secret', '')}\n"
f"dns_alicloud_region = {creds.get('region', 'cn-hangzhou')}\n"
)
creds_file = tempfile.NamedTemporaryFile(
mode="w", suffix=".ini", prefix="certbot-dns-", delete=False
@@ -192,8 +193,14 @@ class AcmeService:
creds_file.write(creds_content)
creds_file.close()
# 用当前 Python 环境对应的 certbot,避免调到系统装的
import sys
certbot_bin = str(Path(sys.prefix) / "bin" / "certbot")
if not Path(certbot_bin).exists():
certbot_bin = "certbot" # fallback
cmd = [
"certbot", "certonly",
certbot_bin, "certonly",
"--non-interactive",
"--agree-tos",
"--email", self.config.email,