Skip to content

Commit

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

Why I did it:
API get_device_runtime_metadata() added by sonic-net#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 zbud-msft committed Aug 31, 2022
1 parent 12c8db0 commit d2a5dcf
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 @@ -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):
Expand Down

0 comments on commit d2a5dcf

Please sign in to comment.