From e1038e8c647a48740683ebe7082c166bb9feb5ab Mon Sep 17 00:00:00 2001 From: malletvapid23 Date: Mon, 21 Jun 2021 00:26:28 +0800 Subject: [PATCH] create sniffer folder if not exist (#1659) - What I did following the change in PR Azure/sonic-buildimage#7830, the folder needs to be created when the first time enables the sniffer function. - How I did it check whether the path to store the sniffer file is existing or not, if not, create it. - How to verify it run command "config platform mlnx sniffer sdk enable", can see sniffer function can be enabled successfully. --- config/plugins/mlnx.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/plugins/mlnx.py b/config/plugins/mlnx.py index 0883aa5..a579e6d 100644 --- a/config/plugins/mlnx.py +++ b/config/plugins/mlnx.py @@ -43,6 +43,8 @@ # generate sniffer target file name include a time stamp. def sniffer_filename_generate(path, filename_prefix, filename_ext): + if not os.path.exists(path): + os.makedirs(path) time_stamp = time.strftime("%Y%m%d%H%M%S") filename = path + filename_prefix + time_stamp + filename_ext return filename