From a9c5600be292f1bd5a0b6916cb6f4dbc342a5c09 Mon Sep 17 00:00:00 2001 From: Zhijian Li Date: Tue, 19 Mar 2024 14:04:38 +0800 Subject: [PATCH] [E1031] Bugfix for Python syntax error in sonic_platform/common.py (#18386) Why I did it Bugfix for Python syntax error in sonic_platform/common.py. A method of class need to have self as parameter. Fixing below issue: e1031:~$ show int st Traceback (most recent call last): File "/usr/local/bin/intfutil", line 836, in main() File "/usr/local/bin/intfutil", line 819, in main interface_stat.display_intf_status() File "/usr/local/bin/intfutil", line 448, in display_intf_status self.get_intf_status() File "/usr/local/lib/python3.9/dist-packages/utilities_common/multi_asic.py", line 157, in wrapped_run_on_all_asics func(self, *args, **kwargs) File "/usr/local/bin/intfutil", line 529, in get_intf_status self.portchannel_speed_dict = po_speed_dict(self.po_int_dict, self.db) File "/usr/local/bin/intfutil", line 334, in po_speed_dict optics_type = port_optics_get(appl_db, value[0], PORT_OPTICS_TYPE) File "/usr/local/bin/intfutil", line 224, in port_optics_get if is_rj45_port(intf_name): File "/usr/local/lib/python3.9/dist-packages/utilities_common/platform_sfputil_helper.py", line 120, in is_rj45_port platform_chassis = sonic_platform.platform.Platform().get_chassis() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/platform.py", line 21, in __init__ self._chassis = Chassis() File "/usr/local/lib/python3.9/dist-packages/sonic_platform/chassis.py", line 37, in __init__ self._is_host = self._api_common.is_host() TypeError: is_host() takes 0 positional arguments but 1 was given Work item tracking Microsoft ADO (number only): 27208152 How I did it Add self parameter to function Common::is_host(). How to verify it Verified on E1031 DUT with this patch. --- device/celestica/x86_64-cel_e1031-r0/sonic_platform/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device/celestica/x86_64-cel_e1031-r0/sonic_platform/common.py b/device/celestica/x86_64-cel_e1031-r0/sonic_platform/common.py index 0838f0cf0a..0dcbf7f33d 100644 --- a/device/celestica/x86_64-cel_e1031-r0/sonic_platform/common.py +++ b/device/celestica/x86_64-cel_e1031-r0/sonic_platform/common.py @@ -183,7 +183,7 @@ class Common: return False return True - def is_host(): + def is_host(self): """ Test whether current process is running on the host or an docker return True for host and False for docker