From 537ad5de43e28e5c1c79d94a3a23fcaacd3eaa31 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Tue, 18 Jun 2019 21:51:17 -0400 Subject: [PATCH] Make ceph pool removal confirmation verbose --- client-cli/pvc.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/client-cli/pvc.py b/client-cli/pvc.py index b05dd947..b110585f 100755 --- a/client-cli/pvc.py +++ b/client-cli/pvc.py @@ -1282,18 +1282,23 @@ def ceph_pool_add(name, pgs): @click.argument( 'name' ) -@click.option('--yes', is_flag=True, - prompt='DANGER: This command will destroy this pool and all volumes. Do you want to continue?' -) -def ceph_pool_remove(name, yes): +def ceph_pool_remove(name): """ Remove a Ceph RBD pool with name NAME and all volumes on it. """ - if yes: - zk_conn = pvc_common.startZKConnection(zk_host) - retcode, retmsg = pvc_ceph.remove_pool(zk_conn, name) - cleanup(retcode, retmsg, zk_conn) + click.echo('DANGER: This will completely remove pool {} and all data contained in it.'.format(name)) + choice = input('Are you sure you want to do this? (y/N) ') + if choice == 'y' or choice == 'Y': + pool_name_check = input('Please enter the pool name to confirm: ') + if pool_name_check == name: + zk_conn = pvc_common.startZKConnection(zk_host) + retcode, retmsg = pvc_ceph.remove_pool(zk_conn, name) + cleanup(retcode, retmsg, zk_conn) + else: + click.echo('Aborting.') + else: + click.echo('Aborting.') ############################################################################### # pvc ceph pool list