From 25b0f43d9f4b28267c31183e1fd11a1c734325cd Mon Sep 17 00:00:00 2001 From: Mahesh Maddikayala <10645050+smaheshm@users.noreply.github.com> Date: Sun, 3 Jan 2021 08:10:28 -0800 Subject: [PATCH] [sonic-py-common] Added an API to get file path containing SONiC version (#6309) * [sonic-py-common] add an API to get file path containing SONiC version so that the API can be mocked for unit tests. --- src/sonic-py-common/sonic_py_common/device_info.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/sonic-py-common/sonic_py_common/device_info.py b/src/sonic-py-common/sonic_py_common/device_info.py index 5f1cb6a66d..f486113196 100644 --- a/src/sonic-py-common/sonic_py_common/device_info.py +++ b/src/sonic-py-common/sonic_py_common/device_info.py @@ -297,6 +297,11 @@ def get_sonic_version_info(): return data +def get_sonic_version_file(): + if not os.path.isfile(SONIC_VERSION_YAML_PATH): + return None + + return SONIC_VERSION_YAML_PATH # # Multi-NPU functionality