bmc: merge update and prepare systemd
The update systemd and prepare systemd were effectively the same, and
this makes the systemd action generic.
Tested: Not tested beyond unit-tests continuing to pass.
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I8070731e53bfd6cdafb1d74d9db652f20341985e
diff --git a/bmc/general_systemd.hpp b/bmc/general_systemd.hpp
index 5c4c0e3..c7fe4cb 100644
--- a/bmc/general_systemd.hpp
+++ b/bmc/general_systemd.hpp
@@ -57,4 +57,39 @@
const std::string triggerService;
const std::string mode;
};
+
+class SystemdNoFile : public TriggerableActionInterface
+{
+ public:
+ static std::unique_ptr<TriggerableActionInterface>
+ CreateSystemdNoFile(sdbusplus::bus::bus&& bus,
+ const std::string& service,
+ const std::string& mode);
+
+ SystemdNoFile(sdbusplus::bus::bus&& bus, const std::string& service,
+ const std::string& mode) :
+ bus(std::move(bus)),
+ triggerService(service), mode(mode)
+ {
+ }
+
+ ~SystemdNoFile() = default;
+ SystemdNoFile(const SystemdNoFile&) = delete;
+ SystemdNoFile& operator=(const SystemdNoFile&) = delete;
+ SystemdNoFile(SystemdNoFile&&) = default;
+ SystemdNoFile& operator=(SystemdNoFile&&) = default;
+
+ bool trigger() override;
+ void abort() override;
+ ActionStatus status() override;
+
+ const std::string getMode() const;
+
+ private:
+ sdbusplus::bus::bus bus;
+ const std::string triggerService;
+ const std::string mode;
+ ActionStatus state = ActionStatus::unknown;
+};
+
} // namespace ipmi_flash