From 93d2e0da6f361ac11744f52b6206e724bd6f82b6 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Fri, 21 Jun 2019 14:16:32 -0400 Subject: [PATCH] Improve handling of init --- client-cli/pvc.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/client-cli/pvc.py b/client-cli/pvc.py index dc11512c..9fd07d76 100755 --- a/client-cli/pvc.py +++ b/client-cli/pvc.py @@ -1499,16 +1499,22 @@ def init_cluster(): ############################################################################### @click.command(name='init', short_help='Initialize a new cluster.') -def init_cluster(): +@click.option( + '--yes', 'yes', + is_flag=True, default_value=False, + help='Pre-confirm the initialization.' +) +def init_cluster(yes): """ Perform initialization of a new PVC cluster. """ - click.echo('DANGER: This will remove any existing cluster on these coordinators and create a new cluster. Any existing resources on the old cluster will be left abandoned.'.format(name)) - choice = input('Are you sure you want to do this? (y/N) ') - if choice == 'y' or choice == 'Y': - import pvc_init - pvc_init.init_zookeeper(zk_host) + if not yes: + click.echo('DANGER: This will remove any existing cluster on these coordinators and create a new cluster. Any existing resources on the old cluster will be left abandoned.') + choice = input('Are you sure you want to do this? (y/N) ') + if choice == 'y' or choice == 'Y': + import pvc_init + pvc_init.init_zookeeper(zk_host) ###############################################################################