@@ -13,13 +13,17 @@ def __init__(self, filepath: str, arguments: Optional[List[str]] = None, *args,
1313 super ().__init__ (* args , ** kwargs )
1414 self .filepath = filepath
1515 self .arguments = arguments
16- self .args = args
17- self .kwargs = kwargs
16+
17+ self .linux_implementation = StartCaptureLinuxImplementation (
18+ filepath = self .filepath ,
19+ arguments = self .arguments ,
20+ * args ,
21+ ** kwargs
22+ )
1823
1924 def dispatch (self , node : Node ) -> Task :
2025 if node .architecture in {Architecture .LINUX_AMD64 , Architecture .LINUX_ARM64 }:
21- return StartCaptureLinuxImplementation (filepath = self .filepath , arguments = self .arguments , * self .args ,
22- ** self .kwargs )
26+ return self .linux_implementation
2327
2428 raise NotImplementedError (
2529 f'StartCapture is not implemented for { node .architecture } '
@@ -49,24 +53,25 @@ def run(self) -> Result:
4953class StopNamedCapture (TaskDispatcher ):
5054 def __init__ (self , start_capture_task_name : str , * args , ** kwargs ):
5155 super ().__init__ (* args , ** kwargs )
52- self .args = args
53- self .kwargs = kwargs
5456 self .start_capture_task_name = start_capture_task_name
57+ self .linux_implementation = StopNamedCaptureLinuxImplementation (
58+ capture_task_name = self .start_capture_task_name ,
59+ * args ,
60+ ** kwargs ,
61+ )
5562
5663 def dispatch (self , node : Node ) -> Task :
5764 if node .architecture in {Architecture .LINUX_AMD64 , Architecture .LINUX_ARM64 }:
58- return StopNamedCaptureLinuxImplementation (
59- * self .args ,
60- capture_task_name = self .start_capture_task_name ,
61- ** self .kwargs ,
62- )
65+ return self .linux_implementation
6366
6467 raise NotImplementedError (
6568 f'StopCapture is not implemented for { node .architecture } '
6669 )
6770
6871
6972class StopNamedCaptureLinuxImplementation (Task ):
73+ requirements = ["sudo apt-get update" , "sudo apt-get install -y tcpdump" ]
74+
7075 def __init__ (self , capture_task_name : str , * args , ** kwargs ):
7176 super ().__init__ (* args , ** kwargs )
7277 self .capture_task_name = capture_task_name
@@ -84,12 +89,11 @@ def run(self):
8489class StopAllTCPDumps (TaskDispatcher ):
8590 def __init__ (self , * args , ** kwargs ):
8691 super ().__init__ (* args , ** kwargs )
87- self .args = args
88- self .kwargs = kwargs
92+ self .linux_implementation = StopAllTCPDumpsLinuxImplementation (* args , ** kwargs )
8993
9094 def dispatch (self , node : Node ) -> Task :
9195 if node .architecture in {Architecture .LINUX_AMD64 , Architecture .LINUX_ARM64 }:
92- return StopAllTCPDumpsLinuxImplementation ( * self .args , ** self . kwargs )
96+ return self .linux_implementation
9397
9498 raise NotImplementedError (
9599 f'StopAllTCPDumps is not implemented for { node .architecture } '
0 commit comments