From 8a388f4b0ed32d2b4d48cef9cef75c0b6ef993df Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Mon, 6 Feb 2023 11:22:31 +0100 Subject: [PATCH] fix(ci): for old versions of python3, pyshark live-capture is buggy Signed-off-by: Raphael Defosseux --- ci-scripts/cls_containerize.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index 8312802aa9..4a897d066b 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -1185,12 +1185,22 @@ class Containerize(): else: return interfaces = [] + iInterfaces = '' for name in networkNames.stdout.split('\n'): if re.search('rfsim', name) is not None or re.search('l2sim', name) is not None: interfaces.append(name) + iInterfaces += f'-i {name} ' ymlPath = self.yamlPath[0].split('/') output_file = f'/tmp/capture_{ymlPath[1]}.pcap' self.tsharkStarted = True + # On old systems (ubuntu 18), pyshark live-capture is buggy. + # Going back to old method + if sys.version_info < (3, 7): + cmd = f'nohup tshark -f "{capture_filter}" {iInterfaces} -w {output_file} > /tmp/tshark.log 2>&1 &' + myCmd = cls_cmd.LocalCmd() + myCmd.run(cmd, timeout=5, reportNonZero=False) + myCmd.close() + return x = threading.Thread(target = self.LaunchPySharkCapture, args = (interfaces,capture_filter,output_file,)) x.daemon = True x.start()