mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-22 16:48:30 +01:00
Enhance help message
Provide more info in help message Add requried opition and they will show missing option if you are not provide them instead of Exception Signed-off-by: DQ <dengq@vmware.com>
This commit is contained in:
parent
b2e1905e7a
commit
d636f2ea5c
@ -10,9 +10,12 @@ from utils.misc import get_realpath
|
||||
gen_tls_script = pathlib.Path(__file__).parent.parent.joinpath('scripts/gencert.sh').absolute()
|
||||
|
||||
@click.command()
|
||||
@click.option('-p', '--path', default='/etc/harbor/tls/internal')
|
||||
@click.option('-d', '--days', default='365')
|
||||
@click.option('-p', '--path', required=True, type=str,help='the path to store generated cert files')
|
||||
@click.option('-d', '--days', default='365', type=int, help='the expired time for cert')
|
||||
def gencert(path, days):
|
||||
"""
|
||||
gencert command will generate cert files for internal TLS
|
||||
"""
|
||||
path = get_realpath(path)
|
||||
click.echo('Check openssl ...')
|
||||
if not openssl_installed():
|
||||
|
@ -8,10 +8,13 @@ from utils.migration import read_conf, search
|
||||
from migrations import accept_versions
|
||||
|
||||
@click.command()
|
||||
@click.option('-i', '--input', 'input_', help="The path of original config file")
|
||||
@click.option('-i', '--input', 'input_', required=True, help="The path of original config file")
|
||||
@click.option('-o', '--output', default='', help="the path of output config file")
|
||||
@click.option('-t', '--target', default='2.0.0', help="target version of input path")
|
||||
def migrate(input_, output, target):
|
||||
"""
|
||||
migrate command will migrate config file style to specific version
|
||||
"""
|
||||
if target not in accept_versions:
|
||||
click.echo('target version {} not supported'.format(target))
|
||||
sys.exit(-1)
|
||||
@ -22,11 +25,10 @@ def migrate(input_, output, target):
|
||||
output_path = get_realpath(output)
|
||||
|
||||
configs = read_conf(input_path)
|
||||
|
||||
input_version = configs.get('_version')
|
||||
if version.parse(input_version) < version.parse('1.9.0'):
|
||||
click.echo('the version {} not supported, make sure the version in input file above 1.8.0'.format(input_version))
|
||||
|
||||
sys.exit(-1)
|
||||
if input_version == target:
|
||||
click.echo("Version of input harbor.yml is identical to target {}, no need to upgrade".format(input_version))
|
||||
sys.exit(0)
|
||||
|
Loading…
Reference in New Issue
Block a user