Files
OpenBMC/meta-luxshare/recipes-phosphor/interfaces/bmcweb/0001-Add-ReleaseDate-for-BMC-inventory.patch
T

92 lines
3.3 KiB
Diff
Raw Normal View History

2026-04-23 17:07:55 +08:00
From f8db58ca9b57df4e97d5775a9038011019299cb3 Mon Sep 17 00:00:00 2001
From: roly <Rolyli.Li@luxshare-ict.com>
Date: Thu, 14 Nov 2024 19:09:27 +0800
Subject: [PATCH] Add ReleaseDate for BMC inventory
---
redfish-core/lib/update_service.hpp | 47 +++++++++++++++++++++++++++--
1 file changed, 44 insertions(+), 3 deletions(-)
diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp
index af2725aa..cc3d939a 100644
--- a/redfish-core/lib/update_service.hpp
+++ b/redfish-core/lib/update_service.hpp
@@ -892,6 +892,45 @@ inline static void
}
}
+inline void
+ getSoftwareReleaseDate(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& service, const std::string& path,
+ const std::string& purpose)
+{
+ if (purpose == sw_util::bmcPurpose)
+ {
+ sdbusplus::asio::getProperty<std::string>(
+ *crow::connections::systemBus, service, path,
+ "xyz.openbmc_project.Software.ReleaseDate", "ReleaseDate",
+ [asyncResp, path](const boost::system::error_code& ec,
+ const std::string& relDate) {
+ if (ec)
+ {
+ if (ec.value() ==
+ boost::system::linux_error::bad_request_descriptor)
+ {
+ BMCWEB_LOG_DEBUG("Priority do not available in {} {}", path,
+ ec.message());
+ }
+ else
+ {
+ BMCWEB_LOG_ERROR(
+ "Error getting Priority property from {}: {}", path,
+ ec.message());
+ messages::internalError(asyncResp->res);
+ }
+ return;
+ }
+
+ asyncResp->res.jsonValue["ReleaseDate"] = relDate;
+ });
+ }
+ else
+ {
+ BMCWEB_LOG_DEBUG("Unknown software purpose {}", purpose);
+ }
+}
+
inline void
getSoftwareVersion(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const std::string& service, const std::string& path,
@@ -900,7 +939,7 @@ inline void
sdbusplus::asio::getAllProperties(
*crow::connections::systemBus, service, path,
"xyz.openbmc_project.Software.Version",
- [asyncResp,
+ [asyncResp, service, path,
swId](const boost::system::error_code& ec,
const dbus::utility::DBusPropertiesMap& propertiesList) {
if (ec)
@@ -961,7 +1000,8 @@ inline void
std::string formatDesc = swInvPurpose->substr(endDesc);
asyncResp->res.jsonValue["Description"] = formatDesc + " image";
getRelatedItems(asyncResp, *swInvPurpose);
- });
+ getSoftwareReleaseDate(asyncResp, service, path, *swInvPurpose);
+ });
}
inline void requestRoutesSoftwareInventory(App& app)
@@ -1003,7 +1043,8 @@ inline void requestRoutesSoftwareInventory(App& app)
std::string, std::vector<std::string>>>>&
obj : subtree)
{
- if (!obj.first.ends_with(*swId))
+ if (sdbusplus::message::object_path(obj.first).filename() !=
+ *swId)
{
continue;
}
--
2.25.1