common: Add getBusName function
Add this function as 'protected' to be able to call it from test code.
The alternative would be to reconstruct the bus name in test code based
on the unique suffix, duplicating the code.
Tested: Inspection only.
Change-Id: Iafed55b5869850f8e1d547e580bdaffd5cfbb6eb
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
diff --git a/common/src/software_manager.cpp b/common/src/software_manager.cpp
index d8493b7..3ef4a51 100644
--- a/common/src/software_manager.cpp
+++ b/common/src/software_manager.cpp
@@ -31,16 +31,13 @@
ctx(ctx),
configIntfAddedMatch(ctx, RulesIntf::interfacesAdded() + matchRuleSender),
configIntfRemovedMatch(ctx, RulesIntf::interfacesRemoved() + matchRulePath),
- serviceNameSuffix(serviceNameSuffix),
+ serviceName("xyz.openbmc_project.Software." + serviceNameSuffix),
manager(ctx, sdbusplus::client::xyz::openbmc_project::software::Version<>::
namespace_path)
{
- const std::string serviceNameFull =
- "xyz.openbmc_project.Software." + serviceNameSuffix;
+ debug("requesting dbus name {BUSNAME}", "BUSNAME", serviceName);
- debug("requesting dbus name {BUSNAME}", "BUSNAME", serviceNameFull);
-
- ctx.request_name(serviceNameFull.c_str());
+ ctx.request_name(serviceName.c_str());
debug("Initialized SoftwareManager");
}
@@ -148,6 +145,11 @@
debug("Done with initial configuration");
}
+std::string SoftwareManager::getBusName()
+{
+ return serviceName;
+}
+
sdbusplus::async::task<void> SoftwareManager::handleInterfaceAdded(
const std::string& service, const std::string& path,
const std::string& interface)