bmc: add mode to systemd preparation action
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: If29311cfa9eddecdd81781867598a73789225bc5
diff --git a/bmc/buildjson.cpp b/bmc/buildjson.cpp
index f817603..9de4b87 100644
--- a/bmc/buildjson.cpp
+++ b/bmc/buildjson.cpp
@@ -104,8 +104,17 @@
if (prepareType == "systemd")
{
const auto& unit = prep.at("unit");
+
+ /* the mode parameter is optional. */
+ std::string systemdMode = "replace";
+ const auto& mode = prep.find("mode");
+ if (mode != prep.end())
+ {
+ systemdMode = prep.at("mode").get<std::string>();
+ }
+
pack->preparation = SystemdPreparation::CreatePreparation(
- sdbusplus::bus::new_default(), unit);
+ sdbusplus::bus::new_default(), unit, systemdMode);
}
else
{