summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Tanous <edtanous@google.com>2022-05-16 19:28:30 +0300
committerEd Tanous <ed@tanous.net>2022-05-16 21:30:04 +0300
commitb2c7e20813074bf498fb0030ee800d1424fcf460 (patch)
tree2ac9458735d8d7a19f896229e6740bbafe2b62c8
parente7dbd530a5c5ba9ae29ee50fd7c1e61a128afc9b (diff)
downloadbmcweb-b2c7e20813074bf498fb0030ee800d1424fcf460.tar.xz
Fix regression in ComputerSystem
Despite the pseudo non-plural name "Links.Chassis", the Redfish schema states that Chassis is an array of chassis, not a singular chassis. While odd, we should obey the specification. This resolves the regression introduced by 1476687de Tested: Code compiles, code inspection looks correct. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I4d6d0554865e412137c44562d173a6efe3f88f4a
-rw-r--r--redfish-core/lib/systems.hpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index e136aeaff3..58bab2ddbf 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -2965,8 +2965,11 @@ inline void requestRoutesSystems(App& app)
getMainChassisId(
asyncResp, [](const std::string& chassisId,
const std::shared_ptr<bmcweb::AsyncResp>& aRsp) {
- aRsp->res.jsonValue["Links"]["Chassis"]["@odata.id"] =
- "/redfish/v1/Chassis/" + chassisId;
+ nlohmann::json::array_t chassisArray;
+ nlohmann::json& chassis = chassisArray.emplace_back();
+ chassis["@odata.id"] = "/redfish/v1/Chassis/" + chassisId;
+ aRsp->res.jsonValue["Links"]["Chassis"] =
+ std::move(chassisArray);
});
getLocationIndicatorActive(asyncResp);