From ad594286b27df743f7702ee2bbe10f1d78b6c792 Mon Sep 17 00:00:00 2001 From: Gary Lin Date: Wed, 25 Jul 2018 11:34:11 +0800 Subject: [PATCH] redfish: Check "Updateable" and "SoftwareId" before using them Although "Updateable" is defined in SoftwareInventory schema since redfish v1.0.0, some machines(*) didn't support the field. "SoftwareId" is defined in SoftwareInventory schema since v1.1.0, so it probably isn't supported by every redfish machines. (*) Try "/redfish/v1/UpdateService/FirmwareInventory/1/" with HPE DL380 Gen 10 in https://ilorestfulapiexplorer.ext.hpe.com/ Signed-off-by: Gary Lin --- plugins/redfish/fu-redfish-client.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/redfish/fu-redfish-client.c b/plugins/redfish/fu-redfish-client.c index eec7edc17..7a9ca5128 100644 --- a/plugins/redfish/fu-redfish-client.c +++ b/plugins/redfish/fu-redfish-client.c @@ -85,9 +85,12 @@ fu_redfish_client_coldplug_member (FuRedfishClient *self, fu_device_set_version_lowest (dev, json_object_get_string_member (member, "LowestSupportedVersion")); if (json_object_has_member (member, "Description")) fu_device_set_description (dev, json_object_get_string_member (member, "Description")); - if (json_object_get_boolean_member (member, "Updateable")) - fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_UPDATABLE); - fu_device_add_guid (dev, json_object_get_string_member (member, "SoftwareId")); + if (json_object_has_member (member, "Updateable")) { + if (json_object_get_boolean_member (member, "Updateable")) + fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_UPDATABLE); + } + if (json_object_has_member (member, "SoftwareId")) + fu_device_add_guid (dev, json_object_get_string_member (member, "SoftwareId")); /* success */ g_ptr_array_add (self->devices, g_steal_pointer (&dev));