bmc: config: add skip action
If you specify the action for one of the three fields as "skip" it'll
create a handler object for that action that always returns success and
has no effect. This action therefore "skips" the step, moving the state
machine forward as though it was a successful real action.
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: Ib4c1091745eb96b8381a332bbeb0562625d3bfbe
diff --git a/bmc/skip_action.hpp b/bmc/skip_action.hpp
new file mode 100644
index 0000000..2ae9377
--- /dev/null
+++ b/bmc/skip_action.hpp
@@ -0,0 +1,39 @@
+#pragma once
+
+#include "status.hpp"
+
+#include <memory>
+
+namespace ipmi_flash
+{
+
+// This type will just return success upon trigger(), and even before calling
+// trigger.
+class SkipAction : public TriggerableActionInterface
+{
+ public:
+ static std::unique_ptr<TriggerableActionInterface> CreateSkipAction();
+
+ SkipAction() = default;
+ ~SkipAction() = default;
+
+ // Disallow copy and assign.
+ SkipAction(const SkipAction&) = delete;
+ SkipAction& operator=(const SkipAction&) = delete;
+ SkipAction(SkipAction&&) = default;
+ SkipAction& operator=(SkipAction&&) = default;
+
+ bool trigger() override
+ {
+ return true;
+ }
+ void abort() override
+ {
+ }
+ ActionStatus status() override
+ {
+ return ActionStatus::success;
+ }
+};
+
+} // namespace ipmi_flash