openbmc_dbus_rest: Allow empty interfaces
In mapper, there is a change to remove the default interfaces for
parent objects that not implement any interfaces.
So there will be the case to get an object that implements no interfaces
from mapper. Handle the case in `handleGet()` so that it does not give
error response.
Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: Ia246ff2e65bd25ec2e1c58e191b34892343ecac7
diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp
index f165c5a..1b5bba6 100644
--- a/include/openbmc_dbus_rest.hpp
+++ b/include/openbmc_dbus_rest.hpp
@@ -1729,8 +1729,6 @@
}
std::shared_ptr<nlohmann::json> response =
std::make_shared<nlohmann::json>(nlohmann::json::object());
- // The mapper should never give us an empty interface names
- // list, but check anyway
for (const std::pair<std::string, std::vector<std::string>>&
connection : objectNames)
{
@@ -1739,10 +1737,9 @@
if (interfaceNames.empty())
{
- setErrorResponse(asyncResp->res,
- boost::beast::http::status::not_found,
- notFoundDesc, notFoundMsg);
- return;
+ // mapper allows empty interfaces in case an
+ // object does not implement any interface.
+ continue;
}
for (const std::string& interface : interfaceNames)