Coverage for /home/fedora/jumpstarter/packages/jumpstarter-driver-tftp/jumpstarter_driver_tftp/client.py: 67%

12 statements  

« prev     ^ index     » next       coverage.py v7.8.0, created at 2025-05-05 20:29 +0000

1from dataclasses import dataclass 

2 

3from jumpstarter_driver_composite.client import CompositeClient 

4 

5 

6@dataclass(kw_only=True) 

7class TftpServerClient(CompositeClient): 

8 """ 

9 Client interface for TFTP Server driver 

10 

11 This client provides methods to control a TFTP server and manage files on it. 

12 Supports file operations like uploading from various storage backends through OpenDAL. 

13 """ 

14 

15 def start(self): 

16 """ 

17 Start the TFTP server 

18 

19 Initializes and starts the TFTP server if it's not already running. 

20 The server will listen on the configured host and port. 

21 """ 

22 self.call("start") 

23 

24 def stop(self): 

25 """ 

26 Stop the TFTP server 

27 

28 Stops the running TFTP server and releases associated resources. 

29 

30 Raises: 

31 ServerNotRunning: If the server is not currently running 

32 """ 

33 self.call("stop") 

34 

35 def get_host(self) -> str: 

36 """ 

37 Get the host address the TFTP server is listening on 

38 

39 Returns: 

40 str: The IP address or hostname the server is bound to 

41 """ 

42 return self.call("get_host") 

43 

44 def get_port(self) -> int: 

45 """ 

46 Get the port number the TFTP server is listening on 

47 

48 Returns: 

49 int: The port number (default is 69) 

50 """ 

51 return self.call("get_port")