From 54aa986e118ac9b8d298da1f4da9164a0ce9544d Mon Sep 17 00:00:00 2001 From: vganesan-nokia <67648637+vganesan-nokia@users.noreply.github.com> Date: Thu, 14 Sep 2023 18:19:29 -0400 Subject: [PATCH] [pmon]chassisd crash fix (#396) This commit has fix for the chassisd crash reported by PR #16465 Root cause: - In the line card pmon, while pushing the hostname to CHASSIS_HOST_TABLE in chassis state db, the slot id is also pushed. The slot id (self.my_slot) is not a string. Since the FieldValue construction function expects string values, the wrapper raises value TypeError exception and hence chassisd exited. Fix: - Fixed by hard converting self.my_slot to string while passing the value to the FieldValue data construction function. Signed-off-by: vedganes Co-authored-by: gechiang <62408185+gechiang@users.noreply.github.com> Co-authored-by: abdosi <58047199+abdosi@users.noreply.github.com> --- sonic-chassisd/scripts/chassisd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonic-chassisd/scripts/chassisd b/sonic-chassisd/scripts/chassisd index 807fec7be..0a54b0832 100644 --- a/sonic-chassisd/scripts/chassisd +++ b/sonic-chassisd/scripts/chassisd @@ -306,7 +306,7 @@ class ModuleUpdater(logger.Logger): if not self._is_supervisor(): hostname_key = "{}{}".format(ModuleBase.MODULE_TYPE_LINE, int(self.my_slot) - 1) hostname = try_get(device_info.get_hostname, default="None") - hostname_fvs = swsscommon.FieldValuePairs([(CHASSIS_MODULE_INFO_SLOT_FIELD, self.my_slot), + hostname_fvs = swsscommon.FieldValuePairs([(CHASSIS_MODULE_INFO_SLOT_FIELD, str(self.my_slot)), (CHASSIS_MODULE_INFO_HOSTNAME_FIELD, hostname), (CHASSIS_MODULE_INFO_NUM_ASICS_FIELD, str(len(module_info_dict[CHASSIS_MODULE_INFO_ASICS])))]) self.hostname_table.set(hostname_key, hostname_fvs)