diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/led.py b/platform/mellanox/mlnx-platform-api/sonic_platform/led.py index 1e401ebbaf..2e6002b77e 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/led.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/led.py @@ -286,9 +286,11 @@ class SharedLed(object): def update_status_led(self): target_color = Led.STATUS_LED_COLOR_GREEN for virtual_led in self._virtual_leds: - if SharedLed.LED_PRIORITY[virtual_led.get_led_color()] < SharedLed.LED_PRIORITY[target_color]: - target_color = virtual_led.get_led_color() - + try: + if SharedLed.LED_PRIORITY[virtual_led.get_led_color()] < SharedLed.LED_PRIORITY[target_color]: + target_color = virtual_led.get_led_color() + except KeyError: + return False return self._led.set_status(target_color) def get_status(self): @@ -302,8 +304,13 @@ class ComponentFaultyIndicator(object): self._shared_led.add_virtual_leds(self) def set_status(self, color): + current_color = self._color self._color = color - return self._shared_led.update_status_led() + if self._shared_led.update_status_led(): + return True + else: + self._color = current_color + return False def get_led_color(self): return self._color