bugfix: bmc: update service requires mode
Systemd startunit requires a job-mode. Default it to "replace." In a
later patchset, the update systemd and verify system will collapse into
one object, but this fix applies to the current implementation.
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: Ia6465abac9979501ea7149933394d8c452b2f315
diff --git a/bmc/buildjson.cpp b/bmc/buildjson.cpp
index a359add..aec9a09 100644
--- a/bmc/buildjson.cpp
+++ b/bmc/buildjson.cpp
@@ -113,7 +113,7 @@
{
const auto& unit = update.at("unit");
pack->update = SystemdUpdateMechanism::CreateSystemdUpdate(
- sdbusplus::bus::new_default(), unit);
+ sdbusplus::bus::new_default(), unit, "replace");
}
else
{
diff --git a/bmc/update_systemd.cpp b/bmc/update_systemd.cpp
index d8f2329..92c97c8 100644
--- a/bmc/update_systemd.cpp
+++ b/bmc/update_systemd.cpp
@@ -45,11 +45,7 @@
auto method = bus.new_method_call(systemdService, systemdRoot,
systemdInterface, "StartUnit");
method.append(target);
-
- if (!mode.empty())
- {
- method.append(mode);
- }
+ method.append(mode);
try
{
diff --git a/bmc/update_systemd.hpp b/bmc/update_systemd.hpp
index 15d616f..fe0ab33 100644
--- a/bmc/update_systemd.hpp
+++ b/bmc/update_systemd.hpp
@@ -17,8 +17,7 @@
public:
static std::unique_ptr<TriggerableActionInterface>
CreateSystemdUpdate(sdbusplus::bus::bus&& bus,
- const std::string& target,
- const std::string& mode = "");
+ const std::string& target, const std::string& mode);
SystemdUpdateMechanism(sdbusplus::bus::bus&& bus, const std::string& target,
const std::string& mode) :