Skip to content

Commit 4e9c6ee

Browse files
committed
pxe: add some type hints
Signed-off-by: Yann Dirson <[email protected]>
1 parent a523d85 commit 4e9c6ee

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

lib/pxe.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
from __future__ import annotations
2+
13
from lib.commands import ssh, scp
24
from data import ARP_SERVER, PXE_CONFIG_SERVER
35

46
PXE_CONFIG_DIR = "/pxe/configs/custom"
57

6-
def generate_boot_conf(directory, installer, action):
8+
def generate_boot_conf(directory: str, installer: str, action: str) -> None:
79
# in case of restore, we disable the text ui from the installer completely,
810
# to workaround a bug that leaves us stuck on a confirmation dialog at the end of the operation.
911
rt = 'rt=1' if action == 'restore' else ''
@@ -15,25 +17,25 @@ def generate_boot_conf(directory, installer, action):
1517
{rt}
1618
""")
1719

18-
def server_push_config(mac_address, tmp_local_path):
20+
def server_push_config(mac_address: str, tmp_local_path: str) -> None:
1921
assert mac_address
2022
remote_dir = f'{PXE_CONFIG_DIR}/{mac_address}/'
2123
server_remove_config(mac_address)
2224
ssh(PXE_CONFIG_SERVER, ['mkdir', '-p', remote_dir])
2325
scp(PXE_CONFIG_SERVER, f'{tmp_local_path}/boot.conf', remote_dir)
2426
scp(PXE_CONFIG_SERVER, f'{tmp_local_path}/answerfile.xml', remote_dir)
2527

26-
def server_remove_config(mac_address):
28+
def server_remove_config(mac_address: str) -> None:
2729
assert mac_address # protection against deleting the whole parent dir!
2830
remote_dir = f'{PXE_CONFIG_DIR}/{mac_address}/'
2931
ssh(PXE_CONFIG_SERVER, ['rm', '-rf', remote_dir])
3032

31-
def server_remove_bootconf(mac_address):
33+
def server_remove_bootconf(mac_address: str) -> None:
3234
assert mac_address
3335
distant_file = f'{PXE_CONFIG_DIR}/{mac_address}/boot.conf'
3436
ssh(PXE_CONFIG_SERVER, ['rm', '-rf', distant_file])
3537

36-
def arp_addresses_for(mac_address):
38+
def arp_addresses_for(mac_address: str) -> list[str]:
3739
output = ssh(
3840
ARP_SERVER,
3941
['ip', 'neigh', 'show', 'nud', 'reachable',

0 commit comments

Comments
 (0)