Activation: Delete version interface after activation

When activation is finished, the version interface and the related
images created by phosphor-version-software-manager shall be deleted.

This is done by invoking the Delete method of the related service, so we
need to get all the services from the object, and get the correct
service to invoke the Delete method.

Tested: Verify the Version interface created by
        xyz.openbmc_project.Software.Version service, and the related
        files in /tmp/image/<versionId> are removed after activation is
        completed.

Signed-off-by: Lei YU <mine260309@gmail.com>
Change-Id: Icb14731bbea35175c2519bd40b9f88a0b54a034a
diff --git a/src/utils.cpp b/src/utils.cpp
index 7a968b7..33e56be 100644
--- a/src/utils.cpp
+++ b/src/utils.cpp
@@ -77,6 +77,18 @@
 std::string Utils::getService(sdbusplus::bus::bus& bus, const char* path,
                               const char* interface) const
 {
+    auto services = getServices(bus, path, interface);
+    if (services.empty())
+    {
+        return {};
+    }
+    return services[0];
+}
+
+std::vector<std::string> Utils::getServices(sdbusplus::bus::bus& bus,
+                                            const char* path,
+                                            const char* interface) const
+{
     auto mapper = bus.new_method_call(MAPPER_BUSNAME, MAPPER_PATH,
                                       MAPPER_INTERFACE, "GetObject");
 
@@ -93,11 +105,12 @@
             log<level::ERR>("Error reading mapper response");
             throw std::runtime_error("Error reading mapper response");
         }
-        if (mapperResponse.size() < 1)
+        std::vector<std::string> ret;
+        for (const auto& i : mapperResponse)
         {
-            return "";
+            ret.emplace_back(i.first);
         }
-        return mapperResponse[0].first;
+        return ret;
     }
     catch (const sdbusplus::exception::SdBusError& ex)
     {