forked from Fediversity/Fediversity
switch subprocess output to logger
This commit is contained in:
parent
9c53abfb4c
commit
d4860c8aed
2 changed files with 12 additions and 2 deletions
|
@ -223,6 +223,10 @@ LOGGING = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SECONDS_PER_MINUTE = 60
|
||||||
|
DEPLOY_TIMEOUT_MINUTES = 25
|
||||||
|
DEPLOY_TIMEOUT_SECONDS = DEPLOY_TIMEOUT_MINUTES * SECONDS_PER_MINUTE
|
||||||
|
|
||||||
# Customization via user settings
|
# Customization via user settings
|
||||||
# This must be at the end, as it must be able to override the above
|
# This must be at the end, as it must be able to override the above
|
||||||
# TODO(@fricklerhandwerk):
|
# TODO(@fricklerhandwerk):
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
import json
|
import json
|
||||||
from os.path import expanduser
|
from os.path import expanduser
|
||||||
|
from subprocess import Popen, PIPE, STDOUT
|
||||||
import subprocess
|
import subprocess
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
@ -160,6 +161,11 @@ class DeploymentStatus(ConfigurationForm):
|
||||||
"--auto-approve",
|
"--auto-approve",
|
||||||
"-lock=false",
|
"-lock=false",
|
||||||
]
|
]
|
||||||
deployment_result = subprocess.run(cmd, cwd=cwd, env=env)
|
popen = Popen(cmd, cwd=cwd, env=env, stdout=PIPE, stderr=STDOUT)
|
||||||
logging.info(deployment_result)
|
with popen.stdout:
|
||||||
|
for line in iter(popen.stdout.readline, b''):
|
||||||
|
logger.info(line.decode('utf-8').strip())
|
||||||
|
# FIXME catch subprocess.TimeoutExpired
|
||||||
|
deployment_result = popen.wait(timeout=settings.DEPLOY_TIMEOUT_SECONDS)
|
||||||
|
logger.info(f"deployment_result: {deployment_result}")
|
||||||
return deployment_result, deployment_params
|
return deployment_result, deployment_params
|
||||||
|
|
Loading…
Add table
Reference in a new issue