common: split inventory association function
Create Software::createInventoryAssociation to split the
object mapper call from actually creating the association.
This makes unit testing the functions easier and provides a clean
separation between the logic provided by common code versus the external
information we are fetching.
Tested: Inspection only.
Change-Id: I0147480219b9c9fbc709699b9e50411fb11bea6e
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
diff --git a/common/include/software.hpp b/common/include/software.hpp
index 2993707..46129da 100644
--- a/common/include/software.hpp
+++ b/common/include/software.hpp
@@ -92,6 +92,13 @@
// @returns a random software id (swid) for that device
static std::string getRandomSoftwareId(device::Device& parent);
+ // @param isRunning if the software version is currently running
+ // on the device. Otherwise the software is assumed to be activating (not
+ // yet running).
+ // @param objectPath The object path of the inventory item to
+ // associate with. We only ever associate to one inventory item.
+ void createInventoryAssociation(bool isRunning, std::string objectPath);
+
private:
Software(sdbusplus::async::context& ctx, device::Device& parent,
const std::string& swid);