flash-ipmi: implement flashVerifyCheck
Change-Id: I21cf68524efc9a4b28662aac086d3b0a6b881599
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/flash-ipmi.cpp b/flash-ipmi.cpp
index 00fa027..e4fafc7 100644
--- a/flash-ipmi.cpp
+++ b/flash-ipmi.cpp
@@ -17,6 +17,7 @@
#include "flash-ipmi.hpp"
#include <cstdio>
+#include <fstream>
#include <phosphor-logging/log.hpp>
using namespace phosphor::logging;
@@ -199,6 +200,30 @@
VerifyCheckResponse FlashUpdate::checkVerify()
{
- /* TODO: implement. */
- return VerifyCheckResponse::other;
+ auto result = VerifyCheckResponse::other;
+ std::ifstream ifs;
+ ifs.open(verifyPath);
+ if (ifs.good())
+ {
+ std::string status;
+ /*
+ * Check for the contents of the file, excepting:
+ * running, success, or failed.
+ */
+ ifs >> status;
+ if (status == "running")
+ {
+ result = VerifyCheckResponse::running;
+ }
+ else if (status == "success")
+ {
+ result = VerifyCheckResponse::success;
+ }
+ else if (status == "failed")
+ {
+ result = VerifyCheckResponse::failed;
+ }
+ }
+
+ return result;
}