Skip to content

Commit 6c14589

Browse files
committed
dhcp: T7052: Clean up unnecessary params in formatter methods
The formatter methods are mostly `family` agnostic now.
1 parent 33ac5b3 commit 6c14589

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/op_mode/dhcp.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def _get_raw_server_pool_statistics(config, family='inet', pool=None):
204204
return stats
205205

206206

207-
def _get_formatted_server_pool_statistics(pool_data, family='inet'):
207+
def _get_formatted_server_pool_statistics(pool_data):
208208
data_entries = []
209209
for entry in pool_data:
210210
pool = entry.get('pool')
@@ -234,7 +234,7 @@ def _get_raw_server_static_mappings(config, family='inet', pool=None, sorted=Non
234234
return mappings
235235

236236

237-
def _get_formatted_server_static_mappings(raw_data, family='inet'):
237+
def _get_formatted_server_static_mappings(raw_data):
238238
data_entries = []
239239

240240
for entry in raw_data:
@@ -244,10 +244,8 @@ def _get_formatted_server_static_mappings(raw_data, family='inet'):
244244
ip_addr = entry.get('ip', 'N/A')
245245
mac_addr = entry.get('mac', 'N/A')
246246
duid = entry.get('duid', 'N/A')
247-
description = entry.get('description', 'N/A')
248-
data_entries.append(
249-
[pool, subnet, hostname, ip_addr, mac_addr, duid, description]
250-
)
247+
desc = entry.get('description', 'N/A')
248+
data_entries.append([pool, subnet, hostname, ip_addr, mac_addr, duid, desc])
251249

252250
headers = [
253251
'Pool',
@@ -326,7 +324,7 @@ def show_server_pool_statistics(
326324
if raw:
327325
return pool_data
328326
else:
329-
return _get_formatted_server_pool_statistics(pool_data, family=family)
327+
return _get_formatted_server_pool_statistics(pool_data)
330328

331329

332330
@_verify_server
@@ -407,7 +405,7 @@ def show_server_static_mappings(
407405
if raw:
408406
return static_mappings
409407
else:
410-
return _get_formatted_server_static_mappings(static_mappings, family=family)
408+
return _get_formatted_server_static_mappings(static_mappings)
411409

412410

413411
def _lease_valid(inet, address):
@@ -481,7 +479,7 @@ def _get_raw_client_leases(family='inet', interface=None):
481479
return lease_data
482480

483481

484-
def _get_formatted_client_leases(lease_data, family):
482+
def _get_formatted_client_leases(lease_data):
485483
from time import localtime
486484
from time import strftime
487485

@@ -533,7 +531,7 @@ def show_client_leases(raw: bool, family: ArgFamily, interface: typing.Optional[
533531
if raw:
534532
return lease_data
535533
else:
536-
return _get_formatted_client_leases(lease_data, family=family)
534+
return _get_formatted_client_leases(lease_data)
537535

538536

539537
@_verify_client

0 commit comments

Comments
 (0)