From 15ded04680ab0b61481e5497060daba4bc6d4aaa Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Tue, 2 Oct 2018 00:14:08 -0400 Subject: [PATCH] Make that wording more consistent --- cli-client/pvc.py | 8 ++++---- client-common/client_lib/network.py | 12 +++++++++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/cli-client/pvc.py b/cli-client/pvc.py index 9516e104..6511476a 100755 --- a/cli-client/pvc.py +++ b/cli-client/pvc.py @@ -733,7 +733,7 @@ def net_list(limit): ############################################################################### # pvc network dhcp ############################################################################### -@click.group(name='dhcp', short_help='Manage a PVC virtual network DHCP reservations.', context_settings=CONTEXT_SETTINGS) +@click.group(name='dhcp', short_help='Manage DHCP leases in a PVC virtual network.', context_settings=CONTEXT_SETTINGS) def net_dhcp(): """ Manage host DHCP leases of a VXLAN network in the PVC cluster. @@ -790,8 +790,8 @@ def net_dhcp_remove(net, lease): ############################################################################### @click.command(name='list', short_help='List DHCP lease objects.') @click.option( - '-r', '--reservations', 'only_reservations', is_flag=True, default=False, - help='Show only static reservations instead of all leases.' + '-s', '--static', 'only_static', is_flag=True, default=False, + help='Show only static leases.' ) @click.argument( 'net' @@ -799,7 +799,7 @@ def net_dhcp_remove(net, lease): @click.argument( 'limit', default=None, required=False ) -def net_dhcp_list(net, limit, only_reservations): +def net_dhcp_list(net, limit, only_static): """ List all DHCP leases in virtual network NET; optionally only match elements matching regex LIMIT; NET can be either a VNI or description. """ diff --git a/client-common/client_lib/network.py b/client-common/client_lib/network.py index 015fa7ab..cd56dd55 100644 --- a/client-common/client_lib/network.py +++ b/client-common/client_lib/network.py @@ -558,7 +558,7 @@ def get_list(zk_conn, limit): return True, '' -def get_list_dhcp_leases(zk_conn, network, limit, only_reservations=False): +def get_list_dhcp_leases(zk_conn, network, limit, only_static=False): # Validate and obtain alternate passed value net_vni = getNetworkVNI(zk_conn, network) if net_vni == None: @@ -580,7 +580,7 @@ def get_list_dhcp_leases(zk_conn, network, limit, only_reservations=False): for lease in full_dhcp_leases_list: valid_lease = False - if only_reservations: + if only_static: lease_timestamp = zkhandler.readdata(zk_conn, '/networks/{}/dhcp_leases/{}'.format(net_vni, lease)) if lease_timestamp == 'static': if limit: @@ -591,7 +591,13 @@ def get_list_dhcp_leases(zk_conn, network, limit, only_reservations=False): else: valid_lease = True else: - valid_lease = True + if limit: + if re.match(limit, lease) != None: + valid_lease = True + if re.match(limit, lease) != None: + valid_lease = True + else: + valid_lease = True if valid_lease: dhcp_leases_list.append(lease)