From d2a5dcfad89da7c44cc7334e55cae7415203d606 Mon Sep 17 00:00:00 2001 From: abdosi <58047199+abdosi@users.noreply.github.com> Date: Wed, 31 Aug 2022 10:48:15 -0700 Subject: [PATCH] Align API get_device_runtime_metadata() for python version < 3.9 (#11900) Why I did it: API get_device_runtime_metadata() added by #11795 uses merge operator for dict but that is supported only for python version >=3.9. This API will be be used by scrips eg:hostcfgd which is still build for buster which does not have python 3.9 support. --- src/sonic-py-common/sonic_py_common/device_info.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 6605c798ec1a..8173c2677275 100644 --- a/src/sonic-py-common/sonic_py_common/device_info.py +++ b/src/sonic-py-common/sonic_py_common/device_info.py @@ -476,7 +476,10 @@ def get_device_runtime_metadata(): 'chassis_type': 'voq' if is_voq_chassis() else 'packet'}} port_metadata = {'ETHERNET_PORTS_PRESENT': True if get_path_to_port_config_file(hwsku=None, asic="0" if is_multi_npu() else None) else False} - return {'DEVICE_RUNTIME_METADATA': chassis_metadata | port_metadata } + runtime_metadata = {} + runtime_metadata.update(chassis_metadata) + runtime_metadata.update(port_metadata) + return {'DEVICE_RUNTIME_METADATA': runtime_metadata } def get_npu_id_from_name(npu_name): if npu_name.startswith(NPU_NAME_PREFIX):