From d974ffd707d6eb1ce625721aa0acc416f18cf99d Mon Sep 17 00:00:00 2001 From: Arun Saravanan Balachandran <52521751+ArunSaravananBalachandran@users.noreply.github.com> Date: Wed, 29 Jun 2022 22:00:58 +0530 Subject: [PATCH] DellEMC Z9332f: 'update_firmware' component API return False if firmware image not found (#10797) Why I did it To return 'False' in update_firmware component API in DellEMC Z9332f platform, if the firmware image is not present in the provided image path. How I did it Updated 'update_firmware' in component.py to return False if image is not found in location provided by 'image_path' How to verify it Verified that the API returns False when an invalid image path is specified. --- .../z9332f/sonic_platform/component.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/component.py index 24619a481c..7e413e041a 100644 --- a/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/component.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/component.py @@ -388,9 +388,15 @@ class Component(ComponentBase): Args: image_path: A string, path to firmware image + Returns: + False if image not found. + Raises: RuntimeError: update failed """ + if not os.path.isfile(image_path): + return False + valid, version = self._get_available_firmware_version(image_path) if valid: avail_ver = version.get(self.name)