control: Store/use trigger enable functions on events
Create and store trigger enablement functions on the events based on the
trigger's configuration so that they can be enabled separately from when
the event is created. This will allow actions that load events to be
able to be parsed and then enabled when the action determines that the
events should be enabled. It also supports the use of SIGHUP to reload
the event configuration since the events JSON configuration must
successfully be loaded before the newly created events can be enabled in
place of the currently enabled events.
Change-Id: I31871ee1691d5e6b26fe16cde2a829c426ad6504
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/control/json/event.hpp b/control/json/event.hpp
index 28f32a4..80e2f95 100644
--- a/control/json/event.hpp
+++ b/control/json/event.hpp
@@ -18,6 +18,7 @@
#include "action.hpp"
#include "config_base.hpp"
#include "group.hpp"
+#include "trigger_aliases.hpp"
#include <nlohmann/json.hpp>
#include <sdbusplus/bus.hpp>
@@ -69,6 +70,14 @@
Event(const json& jsonObj, Manager* mgr,
std::map<configKey, std::unique_ptr<Zone>>& zones);
+ /**
+ * @brief Enable the event
+ *
+ * Performs the necessary tasks to enable the event such as enabling all the
+ * event triggers, etc...
+ */
+ void enable();
+
private:
/* The sdbusplus bus object */
sdbusplus::bus::bus& _bus;
@@ -85,6 +94,9 @@
/* List of actions for this event */
std::vector<std::unique_ptr<ActionBase>> _actions;
+ /* List of trigger enablement functions for this event */
+ std::vector<trigger::enableTrigger> _triggers;
+
/**
* @brief Load the groups available to be configured on events
*