mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
Fix certbot execution in letsencrypt jobs
This commit is contained in:
parent
64a0a17b20
commit
abf716500c
2 changed files with 10 additions and 8 deletions
|
|
@ -28,7 +28,7 @@ LETS_ENCRYPT_LOGS_DIR = join(sep, "var", "log", "bunkerweb")
|
|||
|
||||
|
||||
def certbot_new(domains: str, email: str, use_letsencrypt_staging: bool = False) -> int:
|
||||
with Popen(
|
||||
process = Popen(
|
||||
[
|
||||
CERTBOT_BIN,
|
||||
"certonly",
|
||||
|
|
@ -57,11 +57,12 @@ def certbot_new(domains: str, email: str, use_letsencrypt_staging: bool = False)
|
|||
stderr=PIPE,
|
||||
universal_newlines=True,
|
||||
env=environ.copy() | {"PYTHONPATH": join(sep, "usr", "share", "bunkerweb", "deps", "python")},
|
||||
) as process:
|
||||
)
|
||||
while process.poll() is None:
|
||||
if process.stderr:
|
||||
for line in process.stderr:
|
||||
LOGGER_CERTBOT.info(line.strip())
|
||||
return process.returncode
|
||||
return process.returncode
|
||||
|
||||
|
||||
status = 0
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ try:
|
|||
|
||||
JOB = Job(LOGGER)
|
||||
|
||||
with Popen(
|
||||
process = Popen(
|
||||
[
|
||||
CERTBOT_BIN,
|
||||
"renew",
|
||||
|
|
@ -64,14 +64,15 @@ try:
|
|||
stderr=PIPE,
|
||||
universal_newlines=True,
|
||||
env=environ.copy() | {"PYTHONPATH": join(sep, "usr", "share", "bunkerweb", "deps", "python")},
|
||||
) as process:
|
||||
)
|
||||
while process.poll() is None:
|
||||
if process.stderr:
|
||||
for line in process.stderr:
|
||||
LOGGER_CERTBOT.info(line.strip())
|
||||
|
||||
if process.returncode == 0:
|
||||
status = 2
|
||||
LOGGER.error("Certificates renewal failed")
|
||||
if process.returncode != 0:
|
||||
status = 2
|
||||
LOGGER.error("Certificates renewal failed")
|
||||
|
||||
# Save Let's Encrypt data to db cache
|
||||
if LETS_ENCRYPT_PATH.is_dir() and list(LETS_ENCRYPT_PATH.iterdir()):
|
||||
|
|
|
|||
Loading…
Reference in a new issue