diff options
author | Ed Tanous <edtanous@google.com> | 2021-12-20 20:34:41 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2022-01-10 20:36:54 +0300 |
commit | 711ac7a931dd3f151fc4064063b5ea90404b9054 (patch) | |
tree | c765543008faaa9c4a82489231aa5ba29d86d2d5 /redfish-core/lib/update_service.hpp | |
parent | 6e3b67ecec7c66d674a6707b6211786fc0704d8a (diff) | |
download | bmcweb-711ac7a931dd3f151fc4064063b5ea90404b9054.tar.xz |
Consistently use ManagedObjectType
Some subsystems seem to have invented their own typedefs for this stuff,
move to using the one typedef in dbus::utility so we're consistent, and
we reduce our templates.
Tested: code compiles
This saves a negligible amount (104 bytes compressed) on our binary
size.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I952ea1f960aa703808d0ac80f35dc24cdd8d5027
Diffstat (limited to 'redfish-core/lib/update_service.hpp')
-rw-r--r-- | redfish-core/lib/update_service.hpp | 117 |
1 files changed, 59 insertions, 58 deletions
diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp index 5f56e353d7..f820e61e76 100644 --- a/redfish-core/lib/update_service.hpp +++ b/redfish-core/lib/update_service.hpp @@ -331,65 +331,66 @@ static void monitorForSoftwareAvailable( { if (interface.first == "xyz.openbmc_project.Logging.Entry") { - BMCWEB_LOG_DEBUG << "Error Match fired"; - const dbus::utility::DBusPropertiesMap& values = - interface.second; - auto find = values.find("Message"); - if (find == values.end()) + for (const std::pair<std::string, + dbus::utility::DbusVariantType>& + value : interface.second) { - return; - } - const std::string* type = - std::get_if<std::string>(&(find->second)); - if (type == nullptr) - { - // if this was our message, timeout will cover it - return; - } - fwAvailableTimer = nullptr; - if (*type == - "xyz.openbmc_project.Software.Image.Error.UnTarFailure") - { - redfish::messages::invalidUpload(asyncResp->res, url, - "Invalid archive"); - } - else if (*type == - "xyz.openbmc_project.Software.Image.Error." - "ManifestFileFailure") - { - redfish::messages::invalidUpload(asyncResp->res, url, - "Invalid manifest"); - } - else if ( - *type == - "xyz.openbmc_project.Software.Image.Error.ImageFailure") - { - redfish::messages::invalidUpload( - asyncResp->res, url, "Invalid image format"); - } - else if ( - *type == - "xyz.openbmc_project.Software.Version.Error.AlreadyExists") - { - redfish::messages::invalidUpload( - asyncResp->res, url, - "Image version already exists"); - - redfish::messages::resourceAlreadyExists( - asyncResp->res, - "UpdateService.v1_5_0.UpdateService", "Version", - "uploaded version"); - } - else if ( - *type == - "xyz.openbmc_project.Software.Image.Error.BusyFailure") - { - redfish::messages::resourceExhaustion(asyncResp->res, - url); - } - else - { - redfish::messages::internalError(asyncResp->res); + if (value.first != "Message") + { + continue; + } + const std::string* type = + std::get_if<std::string>(&value.second); + if (type == nullptr) + { + // if this was our message, timeout will cover it + return; + } + fwAvailableTimer = nullptr; + if (*type == + "xyz.openbmc_project.Software.Image.Error.UnTarFailure") + { + redfish::messages::invalidUpload( + asyncResp->res, url, "Invalid archive"); + } + else if (*type == + "xyz.openbmc_project.Software.Image.Error." + "ManifestFileFailure") + { + redfish::messages::invalidUpload( + asyncResp->res, url, "Invalid manifest"); + } + else if ( + *type == + "xyz.openbmc_project.Software.Image.Error.ImageFailure") + { + redfish::messages::invalidUpload( + asyncResp->res, url, "Invalid image format"); + } + else if ( + *type == + "xyz.openbmc_project.Software.Version.Error.AlreadyExists") + { + redfish::messages::invalidUpload( + asyncResp->res, url, + "Image version already exists"); + + redfish::messages::resourceAlreadyExists( + asyncResp->res, + "UpdateService.v1_5_0.UpdateService", "Version", + "uploaded version"); + } + else if ( + *type == + "xyz.openbmc_project.Software.Image.Error.BusyFailure") + { + redfish::messages::resourceExhaustion( + asyncResp->res, url); + } + else + { + redfish::messages::internalError(asyncResp->res); + } } } } |