Make that wording more consistent

This commit is contained in:
Joshua Boniface 2018-10-02 00:14:08 -04:00
parent e1ef9e1af1
commit 15ded04680
2 changed files with 13 additions and 7 deletions

View File

@ -733,7 +733,7 @@ def net_list(limit):
############################################################################### ###############################################################################
# pvc network dhcp # 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(): def net_dhcp():
""" """
Manage host DHCP leases of a VXLAN network in the PVC cluster. 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.command(name='list', short_help='List DHCP lease objects.')
@click.option( @click.option(
'-r', '--reservations', 'only_reservations', is_flag=True, default=False, '-s', '--static', 'only_static', is_flag=True, default=False,
help='Show only static reservations instead of all leases.' help='Show only static leases.'
) )
@click.argument( @click.argument(
'net' 'net'
@ -799,7 +799,7 @@ def net_dhcp_remove(net, lease):
@click.argument( @click.argument(
'limit', default=None, required=False '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. List all DHCP leases in virtual network NET; optionally only match elements matching regex LIMIT; NET can be either a VNI or description.
""" """

View File

@ -558,7 +558,7 @@ def get_list(zk_conn, limit):
return True, '' 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 # Validate and obtain alternate passed value
net_vni = getNetworkVNI(zk_conn, network) net_vni = getNetworkVNI(zk_conn, network)
if net_vni == None: 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: for lease in full_dhcp_leases_list:
valid_lease = False valid_lease = False
if only_reservations: if only_static:
lease_timestamp = zkhandler.readdata(zk_conn, '/networks/{}/dhcp_leases/{}'.format(net_vni, lease)) lease_timestamp = zkhandler.readdata(zk_conn, '/networks/{}/dhcp_leases/{}'.format(net_vni, lease))
if lease_timestamp == 'static': if lease_timestamp == 'static':
if limit: if limit:
@ -590,6 +590,12 @@ def get_list_dhcp_leases(zk_conn, network, limit, only_reservations=False):
valid_lease = True valid_lease = True
else: else:
valid_lease = True valid_lease = True
else:
if limit:
if re.match(limit, lease) != None:
valid_lease = True
if re.match(limit, lease) != None:
valid_lease = True
else: else:
valid_lease = True valid_lease = True