Make ceph pool removal confirmation verbose

This commit is contained in:
Joshua Boniface 2019-06-18 21:51:17 -04:00
parent ee73676114
commit 537ad5de43
1 changed files with 13 additions and 8 deletions

View File

@ -1282,18 +1282,23 @@ def ceph_pool_add(name, pgs):
@click.argument( @click.argument(
'name' 'name'
) )
@click.option('--yes', is_flag=True, def ceph_pool_remove(name):
prompt='DANGER: This command will destroy this pool and all volumes. Do you want to continue?'
)
def ceph_pool_remove(name, yes):
""" """
Remove a Ceph RBD pool with name NAME and all volumes on it. Remove a Ceph RBD pool with name NAME and all volumes on it.
""" """
if yes: click.echo('DANGER: This will completely remove pool {} and all data contained in it.'.format(name))
zk_conn = pvc_common.startZKConnection(zk_host) choice = input('Are you sure you want to do this? (y/N) ')
retcode, retmsg = pvc_ceph.remove_pool(zk_conn, name) if choice == 'y' or choice == 'Y':
cleanup(retcode, retmsg, zk_conn) 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 # pvc ceph pool list