control: Use getSubTreeRaw call in addServices
In cases where a property used by an action isn't on D-Bus on startup,
the original getSubTree() call would throw an unhandled exception which
would crash the daemon. Change to getSubTreeRaw() so that doesn't
happen.
Also change a trace that a occurs when a D-Bus service isn't found to
debug as that is expected in this case.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: Ibd147c303d40761f75f961a9ce404139c2b2c134
diff --git a/control/json/manager.cpp b/control/json/manager.cpp
index 7202471..372fb78 100644
--- a/control/json/manager.cpp
+++ b/control/json/manager.cpp
@@ -283,8 +283,8 @@
void Manager::addServices(const std::string& intf, int32_t depth)
{
// Get all subtree objects for the given interface
- auto objects = util::SDBusPlus::getSubTree(util::SDBusPlus::getBus(), "/",
- intf, depth);
+ auto objects = util::SDBusPlus::getSubTreeRaw(util::SDBusPlus::getBus(),
+ "/", intf, depth);
// Add what's returned to the cache of path->services
for (auto& itPath : objects)
{
@@ -388,7 +388,7 @@
if (service.empty())
{
// Log service not found for object
- log<level::ERR>(
+ log<level::DEBUG>(
fmt::format("Unable to get service name for path {}, interface {}",
path, intf)
.c_str());