Skip to content

Commit

Permalink
Align API get_device_runtime_metadata() for python version < 3.9 (#11900
Browse files Browse the repository at this point in the history
)

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.
  • Loading branch information
abdosi authored and yxieca committed Sep 1, 2022
1 parent 72852cd commit 3d8d516
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/sonic-py-common/sonic_py_common/device_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,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):
Expand Down

0 comments on commit 3d8d516

Please sign in to comment.