control: Load config file(s) when available
Fan control's config file(s) are loaded when the fan control service
starts if found either in the override location, default location, or
the compatible interface is available. When the required config file(s)
are not found at startup, it waits to receive the interfacesAdded signal
that the compatible interface is available and then loads its config
file(s).
If at any point another interfacesAdded signal for the compatible
interface is received after successfully loading its config file(s),
this signal is ignored. So the only method to reload the config file(s)
is by providing the SIGHUP signal.
Change-Id: I14f93a684bb00a6a32f8cb228cbfb9ce3f022c92
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/control/json/manager.hpp b/control/json/manager.hpp
index ce1c869..df6edb3 100644
--- a/control/json/manager.hpp
+++ b/control/json/manager.hpp
@@ -422,6 +422,16 @@
return _powerState->isPowerOn();
}
+ /**
+ * @brief Load all the fan control JSON configuration files
+ *
+ * This is where all the fan control JSON configuration files are parsed and
+ * loaded into their associated objects. Anything that needs to be done when
+ * the Manager object is constructed or handling a SIGHUP to reload the
+ * configurations needs to be done here.
+ */
+ void load();
+
private:
/* The sdbusplus bus object to use */
sdbusplus::bus::bus& _bus;
@@ -432,6 +442,9 @@
/* The sdbusplus manager object to set the ObjectManager interface */
sdbusplus::server::manager::manager _mgr;
+ /* Whether loading the config files is allowed or not */
+ bool _loadAllowed;
+
/* The system's power state determination object */
std::unique_ptr<PowerState> _powerState;
@@ -466,16 +479,6 @@
std::map<configKey, std::unique_ptr<Event>> _events;
/**
- * @brief Load all the fan control JSON configuration files
- *
- * This is where all the fan control JSON configuration files are parsed and
- * loaded into their associated objects. Anything that needs to be done when
- * the Manager object is constructed or handling a SIGHUP to reload the
- * configurations needs to be done here.
- */
- void load();
-
- /**
* @brief Callback for power state changes
*
* @param[in] powerStateOn - Whether the power state is on or not