entity-manager: Add meson option to cache config
For the development use-case configuration is often changed and the
general expectation is for a service to re-parse it's configuration when
it is restarted.
Add a meson option which controls if the configuration (usually in
/var/configuration/system.json) is cached there, or not cached at all.
The new meson option is 'new-device-detection' and by
default it is true, so there is no behavior change when it is not
configured.
Tested: on Tyan S5549 board.
The configuration is cached when the option is left as default and the
configuration is not written to cache when it is set to false.
```
Jan 21 15:50:22 s5549-bmc-a0423f63b4a5 systemd[1]: Starting Entity Manager...
Jan 21 15:50:22 s5549-bmc-a0423f63b4a5 systemd[1]: Started Entity Manager.
Jan 21 15:50:35 s5549-bmc-a0423f63b4a5 entity-manager[32126]: Inventory Added: Supermicro PWS 920P SQ 1
Jan 21 15:50:35 s5549-bmc-a0423f63b4a5 entity-manager[32126]: Inventory Added: MBX 1.60 Chassis
Jan 21 15:50:35 s5549-bmc-a0423f63b4a5 entity-manager[32126]: Inventory Added: Tyan S5549 Baseboard
```
The cache directory now only contains the 'version' file which is
separate from the caching concern, and not affected by this patch.
```
ls -l /var/configuration/
-rw-r--r-- 1 root root 10 Jan 16 11:50 version
```
Change-Id: I584d87c549d3115da04b464702c7fda8ee7720ed
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
diff --git a/src/entity_manager/log_device_inventory.cpp b/src/entity_manager/log_device_inventory.cpp
index 02a888d..5a8a918 100644
--- a/src/entity_manager/log_device_inventory.cpp
+++ b/src/entity_manager/log_device_inventory.cpp
@@ -9,6 +9,10 @@
void logDeviceAdded(const nlohmann::json& record)
{
+ if (!EM_CACHE_CONFIGURATION)
+ {
+ return;
+ }
if (!deviceHasLogging(record))
{
return;