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/buildjson.cpp b/bmc/buildjson.cpp
index 478fb7c..3fdda31 100644
--- a/bmc/buildjson.cpp
+++ b/bmc/buildjson.cpp
@@ -18,6 +18,7 @@
 #include "file_handler.hpp"
 #include "fs.hpp"
 #include "general_systemd.hpp"
+#include "skip_action.hpp"
 
 #include <algorithm>
 #include <cstdio>
@@ -109,18 +110,17 @@
             const auto& a = item.at("actions");
             std::unique_ptr<ActionPack> pack = std::make_unique<ActionPack>();
 
-            /* It hasn't been fully determined if any action being optional is
-             * useful, so for now they will be required.
-             * TODO: Evaluate how the behaviors change if some actions are
-             * missing, does the code just assume it was successful?  I would
-             * think not.
-             */
+            /* to make an action optional, assign type "skip" */
             const auto& prep = a.at("preparation");
             const std::string prepareType = prep.at("type");
             if (prepareType == "systemd")
             {
                 pack->preparation = std::move(buildSystemd(prep));
             }
+            else if (prepareType == "skip")
+            {
+                pack->preparation = SkipAction::CreateSkipAction();
+            }
             else
             {
                 throw std::runtime_error("Invalid preparation type: " +
@@ -137,6 +137,10 @@
             {
                 pack->verification = std::move(buildSystemd(verify));
             }
+            else if (verifyType == "skip")
+            {
+                pack->verification = SkipAction::CreateSkipAction();
+            }
             else
             {
                 throw std::runtime_error("Invalid verification type:" +
@@ -159,6 +163,10 @@
             {
                 pack->update = std::move(buildSystemd(update));
             }
+            else if (updateType == "skip")
+            {
+                pack->update = SkipAction::CreateSkipAction();
+            }
             else
             {
                 throw std::runtime_error("Invalid update type: " + updateType);