mirror of
https://github.com/goharbor/harbor.git
synced 2025-01-02 22:18:29 +01:00
Enhance: output the stdout of gen cert script
use popen replace check_all Signed-off-by: DQ <dengq@vmware.com>
This commit is contained in:
parent
06d955c6e3
commit
90faf700f8
@ -2,7 +2,8 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import click
|
import click
|
||||||
import pathlib
|
import pathlib
|
||||||
from subprocess import check_call, PIPE, STDOUT
|
import logging
|
||||||
|
from subprocess import Popen, PIPE, STDOUT, CalledProcessError
|
||||||
|
|
||||||
from utils.cert import openssl_installed
|
from utils.cert import openssl_installed
|
||||||
from utils.misc import get_realpath
|
from utils.misc import get_realpath
|
||||||
@ -25,8 +26,8 @@ def gencert(path, days):
|
|||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
click.echo('path {} not exist, create it...'.format(path))
|
click.echo('path {} not exist, create it...'.format(path))
|
||||||
os.makedirs(path, exist_ok=True)
|
os.makedirs(path, exist_ok=True)
|
||||||
|
with Popen([gen_tls_script, days], stdout=PIPE, stderr=STDOUT, cwd=path) as p:
|
||||||
shell_stat = check_call([gen_tls_script, days], stdout=PIPE, stderr=STDOUT, cwd=path)
|
for line in p.stdout:
|
||||||
if shell_stat != 0:
|
click.echo(line, nl=False)
|
||||||
click.echo('Can not generate internal tls certs')
|
if p.returncode != 0:
|
||||||
sys.exit(-1)
|
raise CalledProcessError(p.returncode, p.args)
|
||||||
|
Loading…
Reference in New Issue
Block a user