summaryrefslogtreecommitdiff
path: root/redfish-core/lib/update_service.hpp
diff options
context:
space:
mode:
authorBrian Ma <chma0@nuvoton.com>2021-12-01 12:05:54 +0300
committerEd Tanous <ed@tanous.net>2022-01-06 19:50:13 +0300
commite1cc482880d7b47dcf19609cedba7df80368ae3c (patch)
tree70dc0f5f99d3b2e437d9f1e89147237b42dcc6e9 /redfish-core/lib/update_service.hpp
parent248d02303212eb1b7b9a81757489a23af36546a8 (diff)
downloadbmcweb-e1cc482880d7b47dcf19609cedba7df80368ae3c.tar.xz
update_service: fix fwUpdateErrorMatcher cannot working
Because the phosphor logging commit ef952af2 stop emitting the propChanged signal before ifacesAdded signal raising, the fwUpdateErrorMatcher cannot get any software error after image update. Update fwUpdateErrorMatcher to get ifacesAdded dbus signal to handle software error. Tested: Post bad manifest image and get "Invalid manifest" error response Signed-off-by: Brian Ma <chma0@nuvoton.com> Change-Id: I066e0cec0ddf7569dd73b2601f838c697bac24da
Diffstat (limited to 'redfish-core/lib/update_service.hpp')
-rw-r--r--redfish-core/lib/update_service.hpp133
1 files changed, 73 insertions, 60 deletions
diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp
index fde878e4aa..5f56e353d7 100644
--- a/redfish-core/lib/update_service.hpp
+++ b/redfish-core/lib/update_service.hpp
@@ -316,70 +316,83 @@ static void monitorForSoftwareAvailable(
fwUpdateErrorMatcher = std::make_unique<sdbusplus::bus::match::match>(
*crow::connections::systemBus,
- "type='signal',member='PropertiesChanged',path_namespace='/xyz/"
- "openbmc_project/logging/entry',"
- "arg0='xyz.openbmc_project.Logging.Entry'",
+ "interface='org.freedesktop.DBus.ObjectManager',type='signal',"
+ "member='InterfacesAdded',"
+ "path='/xyz/openbmc_project/logging'",
[asyncResp, url](sdbusplus::message::message& m) {
- BMCWEB_LOG_DEBUG << "Error Match fired";
- boost::container::flat_map<std::string,
- dbus::utility::DbusVariantType>
- values;
- std::string objName;
- m.read(objName, values);
- auto find = values.find("Message");
- if (find == values.end())
- {
- return;
- }
- std::string* type = std::get_if<std::string>(&(find->second));
- if (type == nullptr)
- {
- return; // if this was our message, timeout will cover it
- }
- if (!boost::starts_with(*type, "xyz.openbmc_project.Software"))
- {
- return;
- }
- 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")
+ std::vector<
+ std::pair<std::string, dbus::utility::DBusPropertiesMap>>
+ interfacesProperties;
+ sdbusplus::message::object_path objPath;
+ m.read(objPath, interfacesProperties);
+ BMCWEB_LOG_DEBUG << "obj path = " << objPath.str;
+ for (const std::pair<std::string, dbus::utility::DBusPropertiesMap>&
+ interface : interfacesProperties)
{
- 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");
+ 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())
+ {
+ 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);
+ 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);
+ }
+ }
}
- fwAvailableTimer = nullptr;
});
}