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 <glin@suse.com>
This commit is contained in:
Gary Lin 2018-07-25 11:34:11 +08:00 committed by Richard Hughes
parent 5b57d7fcd3
commit ad594286b2

View File

@ -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));