entity-manager: move bool inProgress to class
```
static bool inProgress
```
is moved to EM class as
```
bool propertiesChangedInProgress
```
to get rid of the static variable.
Tested: On Tyan S8030
```
Jul 01 09:59:26 s8030-bmc-30303035c0c1 entity-manager[4204]: Inventory Added: Supermicro PWS 920P SQ 0
Jul 01 09:59:26 s8030-bmc-30303035c0c1 entity-manager[4204]: Inventory Added: Supermicro PWS 920P SQ 1
Jul 01 09:59:26 s8030-bmc-30303035c0c1 entity-manager[4204]: Inventory Added: chassis
Jul 01 09:59:26 s8030-bmc-30303035c0c1 entity-manager[4204]: Inventory Added: MBX 1.57 Chassis
```
busctl tree output as expected
Change-Id: I63231cfc155c1c955c8d11f8a32359be4a95e19c
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
diff --git a/src/entity_manager/entity_manager.cpp b/src/entity_manager/entity_manager.cpp
index f2fbb47..deb62d2 100644
--- a/src/entity_manager/entity_manager.cpp
+++ b/src/entity_manager/entity_manager.cpp
@@ -466,7 +466,6 @@
// main properties changed entry
void EntityManager::propertiesChangedCallback()
{
- static bool inProgress = false;
static boost::asio::steady_timer timer(io);
static size_t instance = 0;
instance++;
@@ -487,12 +486,12 @@
return;
}
- if (inProgress)
+ if (propertiesChangedInProgress)
{
propertiesChangedCallback();
return;
}
- inProgress = true;
+ propertiesChangedInProgress = true;
nlohmann::json oldConfiguration = systemConfiguration;
auto missingConfigurations = std::make_shared<nlohmann::json>();
@@ -502,7 +501,7 @@
if (!configuration::loadConfigurations(configurations))
{
std::cerr << "Could not load configurations\n";
- inProgress = false;
+ propertiesChangedInProgress = false;
return;
}
@@ -528,7 +527,7 @@
logDeviceAdded(device);
}
- inProgress = false;
+ propertiesChangedInProgress = false;
boost::asio::post(io, [this, newConfiguration, count] {
publishNewConfiguration(std::ref(instance), count,
diff --git a/src/entity_manager/entity_manager.hpp b/src/entity_manager/entity_manager.hpp
index 81c2136..f730dde 100644
--- a/src/entity_manager/entity_manager.hpp
+++ b/src/entity_manager/entity_manager.hpp
@@ -68,6 +68,8 @@
bool scannedPowerOff = false;
bool scannedPowerOn = false;
+ bool propertiesChangedInProgress = false;
+
void startRemovedTimer(boost::asio::steady_timer& timer,
nlohmann::json& systemConfiguration);
};