From 6ee3c91a637defabd4d9a7575ca6044d21883cd2 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Fri, 5 Jul 2019 13:57:15 -0400 Subject: [PATCH] Use None instead of all in ceph.py Make it like other optional args (like direction in net ACLs) and use None instead of 'all' when specifying any option --- client-cli/pvc.py | 6 +++--- client-common/ceph.py | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/client-cli/pvc.py b/client-cli/pvc.py index 6fb32310..83282ea9 100755 --- a/client-cli/pvc.py +++ b/client-cli/pvc.py @@ -1460,7 +1460,7 @@ def ceph_volume_remove(pool, name, yes): ) @click.option( '-p', '--pool', 'pool', - default='all', show_default=True, + default=None, show_default=True, help='Show volumes from this pool only.' ) def ceph_volume_list(limit, pool): @@ -1549,12 +1549,12 @@ def ceph_volume_snapshot_remove(pool, volume, name, yes): ) @click.option( '-p', '--pool', 'pool', - default='all', show_default=True, + default=None, show_default=True, help='Show snapshots from this pool only.' ) @click.option( '-p', '--volume', 'volume', - default='all', show_default=True, + default=None, show_default=True, help='Show snapshots from this volume only.' ) def ceph_volume_snapshot_list(pool, volume, limit): diff --git a/client-common/ceph.py b/client-common/ceph.py index 0373cab2..6a3cdf84 100644 --- a/client-common/ceph.py +++ b/client-common/ceph.py @@ -855,7 +855,7 @@ Wr: {pool_write_ops: <{pool_write_ops_length}} \ # def getCephVolumes(zk_conn, pool): volume_list = list() - if pool == 'all': + if not pool: pool_list = zkhandler.listchildren(zk_conn, '/ceph/pools') else: pool_list = [ pool ] @@ -944,7 +944,7 @@ def remove_volume(zk_conn, pool, name): def get_list_volume(zk_conn, pool, limit): volume_list = [] - if pool != 'all' and not verifyPool(zk_conn, name): + if pool and not verifyPool(zk_conn, name): return False, 'ERROR: No pool with name "{}" is present in the cluster.'.format(name) full_volume_list = getCephVolumes(zk_conn, pool) @@ -1085,7 +1085,7 @@ def getCephSnapshots(zk_conn, pool, volume): volume_list = list() volume_list = getCephVolumes(zk_conn, pool) - if volume != 'all': + if volume: for volume_entry in volume_list: volume_pool, volume_name = volume_entry.split('/') if volume_name == volume: @@ -1160,10 +1160,10 @@ def remove_snapshot(zk_conn, pool, volume, name): def get_list_snapshot(zk_conn, pool, volume, limit): snapshot_list = [] - if pool != 'all' and not verifyPool(zk_conn, pool): + if pool and not verifyPool(zk_conn, pool): return False, 'ERROR: No pool with name "{}" is present in the cluster.'.format(pool) - if volume != 'all' and not verifyPool(zk_conn, volume): + if volume and not verifyPool(zk_conn, volume): return False, 'ERROR: No volume with name "{}" is present in the cluster.'.format(volume) full_snapshot_list = getCephSnapshots(zk_conn, pool, volume)