util: Logging error on getService optional
Make logging an error on service name lookup for a given path/interface
optional for the case where a service may not be available yet. This is
to handle the case where a service dependent on a property from another
may be started in parallel by systemd where the property would need to
be retrieved by other means (i.e. interfacesAdded signal).
Tested:
No change to current users of getService util function
No error logged when service not found
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
Change-Id: Ib570b83fe2feae07031fa477f468327a7b0554b0
diff --git a/utility.hpp b/utility.hpp
index 8084782..af50127 100644
--- a/utility.hpp
+++ b/utility.hpp
@@ -29,11 +29,12 @@
* @param[in] path - the D-Bus path name
* @param[in] interface - the D-Bus interface name
* @param[in] bus - the D-Bus object
+ * @param[in] logError - log error when no service found
*
* @return The service name
*/
std::string getService(const std::string& path, const std::string& interface,
- sdbusplus::bus::bus& bus);
+ sdbusplus::bus::bus& bus, bool logError = true);
/**
* @brief Read a D-Bus property