entity-manager: constructor arg to load config
Introduce a constructor arg to point EM to directories to load
configuration from.
This enables running unit tests without depending on a specific
directory layout from our rofs.
Tested: on Tyan S8030. Config parsed as expected.
```
Oct 02 11:22:52 s8030-bmc-30303035c0c1 systemd[1]: Starting Entity Manager...
Oct 02 11:22:52 s8030-bmc-30303035c0c1 systemd[1]: Started Entity Manager.
Oct 02 11:23:02 s8030-bmc-30303035c0c1 entity-manager[8265]: There's still template variable $PRODUCT_PART_NUMBER un-replaced. Removing it from the string.
Oct 02 11:23:02 s8030-bmc-30303035c0c1 entity-manager[8265]: There's still template variable $PRODUCT_ASSET_TAG un-replaced. Removing it from the string.
Oct 02 11:23:02 s8030-bmc-30303035c0c1 entity-manager[8265]: There's still template variable $PRODUCT_ASSET_TAG un-replaced. Removing it from the string.
Oct 02 11:23:02 s8030-bmc-30303035c0c1 entity-manager[8265]: There's still template variable $PRODUCT_ASSET_TAG un-replaced. Removing it from the string.
Oct 02 11:23:02 s8030-bmc-30303035c0c1 entity-manager[8265]: There's still template variable $PRODUCT_PART_NUMBER un-replaced. Removing it from the string.
Oct 02 11:23:04 s8030-bmc-30303035c0c1 entity-manager[8265]: Inventory Added: Supermicro PWS 920P SQ 0
Oct 02 11:23:04 s8030-bmc-30303035c0c1 entity-manager[8265]: Inventory Added: Supermicro PWS 920P SQ 1
Oct 02 11:23:04 s8030-bmc-30303035c0c1 entity-manager[8265]: Inventory Added: Tyan S8030 Baseboard
Oct 02 11:23:04 s8030-bmc-30303035c0c1 entity-manager[8265]: Inventory Added: MBX 1.57 Chassis
```
Change-Id: I8ce297847d3cafe2e2ae2040e9db261dc1d8f426
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
diff --git a/src/entity_manager/main.cpp b/src/entity_manager/main.cpp
index ebd27f8..8b8ead5 100644
--- a/src/entity_manager/main.cpp
+++ b/src/entity_manager/main.cpp
@@ -10,10 +10,13 @@
int main()
{
+ const std::vector<std::filesystem::path> configurationDirectories = {
+ PACKAGE_DIR "configurations", SYSCONF_DIR "configurations"};
+
boost::asio::io_context io;
auto systemBus = std::make_shared<sdbusplus::asio::connection>(io);
systemBus->request_name("xyz.openbmc_project.EntityManager");
- EntityManager em(systemBus, io);
+ EntityManager em(systemBus, io, configurationDirectories);
boost::asio::post(io, [&]() { em.propertiesChangedCallback(); });