merge Verification and Update statuses
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: Ibb9c1c9f9cb7e9cda18f4e8dddb31d57a12f0d90
diff --git a/firmware_handler.cpp b/firmware_handler.cpp
index 9cb78fb..26893e3 100644
--- a/firmware_handler.cpp
+++ b/firmware_handler.cpp
@@ -175,37 +175,24 @@
return true;
}
-VerifyCheckResponses FirmwareBlobHandler::getVerifyStatus()
+ActionStatus FirmwareBlobHandler::getActionStatus()
{
- VerifyCheckResponses value = VerifyCheckResponses::other;
+ ActionStatus value = ActionStatus::unknown;
switch (state)
{
case UpdateState::verificationPending:
- value = VerifyCheckResponses::other;
+ value = ActionStatus::unknown;
break;
case UpdateState::verificationStarted:
value = verification->status();
- lastVerificationResponse = value;
+ lastVerificationStatus = value;
break;
case UpdateState::verificationCompleted:
- value = lastVerificationResponse;
+ value = lastVerificationStatus;
break;
- default:
- break;
- }
-
- return value;
-}
-
-UpdateStatus FirmwareBlobHandler::getUpdateStatus()
-{
- UpdateStatus value = UpdateStatus::unknown;
-
- switch (state)
- {
case UpdateState::updatePending:
- value = UpdateStatus::unknown;
+ value = ActionStatus::unknown;
break;
case UpdateState::updateStarted:
value = update->status();
@@ -241,43 +228,31 @@
meta->metadata.clear();
- if (item->second->activePath == verifyBlobId)
+ if (item->second->activePath == verifyBlobId ||
+ item->second->activePath == updateBlobId)
{
- VerifyCheckResponses value = getVerifyStatus();
+ ActionStatus value = getActionStatus();
meta->metadata.push_back(static_cast<std::uint8_t>(value));
/* Change the firmware handler's state and the blob's stat value
* depending.
*/
- if (value == VerifyCheckResponses::success ||
- value == VerifyCheckResponses::failed)
+ if (value == ActionStatus::success || value == ActionStatus::failed)
{
- state = UpdateState::verificationCompleted;
- item->second->flags &= ~blobs::StateFlags::committing;
-
- if (value == VerifyCheckResponses::success)
+ if (item->second->activePath == verifyBlobId)
{
- item->second->flags |= blobs::StateFlags::committed;
+ state = UpdateState::verificationCompleted;
}
else
{
- item->second->flags |= blobs::StateFlags::commit_error;
+ /* item->second->activePath == updateBlobId */
+ state = UpdateState::updateCompleted;
}
- }
- }
- else if (item->second->activePath == updateBlobId)
- {
- UpdateStatus value = getUpdateStatus();
- meta->metadata.push_back(static_cast<std::uint8_t>(value));
-
- if (value == UpdateStatus::success || value == UpdateStatus::failed)
- {
- state = UpdateState::updateCompleted;
item->second->flags &= ~blobs::StateFlags::committing;
- if (value == UpdateStatus::success)
+ if (value == ActionStatus::success)
{
item->second->flags |= blobs::StateFlags::committed;
}
@@ -669,7 +644,7 @@
*/
return false;
case UpdateState::verificationCompleted:
- if (lastVerificationResponse == VerifyCheckResponses::success)
+ if (lastVerificationStatus == ActionStatus::success)
{
state = UpdateState::updatePending;
addBlobId(updateBlobId);
diff --git a/firmware_handler.hpp b/firmware_handler.hpp
index e08cb66..649b059 100644
--- a/firmware_handler.hpp
+++ b/firmware_handler.hpp
@@ -195,8 +195,8 @@
blobIDs.end());
}
- VerifyCheckResponses getVerifyStatus();
- UpdateStatus getUpdateStatus();
+ ActionStatus getVerifyStatus();
+ ActionStatus getActionStatus();
/** List of handlers by type. */
std::vector<HandlerPack> handlers;
@@ -235,9 +235,9 @@
/** Temporary variable to track whether a blob is open. */
bool fileOpen = false;
- VerifyCheckResponses lastVerificationResponse = VerifyCheckResponses::other;
+ ActionStatus lastVerificationStatus = ActionStatus::unknown;
- UpdateStatus lastUpdateStatus = UpdateStatus::unknown;
+ ActionStatus lastUpdateStatus = ActionStatus::unknown;
};
} // namespace ipmi_flash
diff --git a/status.hpp b/status.hpp
index 667c050..2789d9c 100644
--- a/status.hpp
+++ b/status.hpp
@@ -5,16 +5,8 @@
namespace ipmi_flash
{
-enum class VerifyCheckResponses : std::uint8_t
-{
- running = 0,
- success = 1,
- failed = 2,
- other = 3,
-};
-
-/** The status of the update mechanism. */
-enum class UpdateStatus : std::uint8_t
+/** The status of the update mechanism or the verification mechanism */
+enum class ActionStatus : std::uint8_t
{
running = 0,
success = 1,
diff --git a/test/bmc_update_mock.hpp b/test/bmc_update_mock.hpp
index 3db9221..296b513 100644
--- a/test/bmc_update_mock.hpp
+++ b/test/bmc_update_mock.hpp
@@ -16,7 +16,7 @@
public:
MOCK_METHOD0(triggerUpdate, bool());
MOCK_METHOD0(abortUpdate, void());
- MOCK_METHOD0(status, UpdateStatus());
+ MOCK_METHOD0(status, ActionStatus());
};
std::unique_ptr<UpdateInterface> CreateUpdateMock()
diff --git a/test/firmware_state_updatecompleted_unittest.cpp b/test/firmware_state_updatecompleted_unittest.cpp
index 95e0a32..7c26688 100644
--- a/test/firmware_state_updatecompleted_unittest.cpp
+++ b/test/firmware_state_updatecompleted_unittest.cpp
@@ -46,7 +46,7 @@
AttemptToOpenFilesReturnsFailureAfterSuccess)
{
/* In state updateCompleted a file is open, which means no others can be. */
- getToUpdateCompleted(UpdateStatus::success);
+ getToUpdateCompleted(ActionStatus::success);
auto blobsToOpen = handler->getBlobIds();
for (const auto& blob : blobsToOpen)
@@ -61,14 +61,14 @@
TEST_F(FirmwareHandlerUpdateCompletedTest,
CallingStatSessionAfterCompletedSuccessReturnsStateWithoutRechecking)
{
- getToUpdateCompleted(UpdateStatus::success);
+ getToUpdateCompleted(ActionStatus::success);
EXPECT_CALL(*updateMockPtr, status()).Times(0);
blobs::BlobMeta meta, expectedMeta = {};
expectedMeta.size = 0;
expectedMeta.blobState = flags | blobs::StateFlags::committed;
expectedMeta.metadata.push_back(
- static_cast<std::uint8_t>(UpdateStatus::success));
+ static_cast<std::uint8_t>(ActionStatus::success));
EXPECT_TRUE(handler->stat(session, &meta));
EXPECT_EQ(expectedMeta, meta);
@@ -78,14 +78,14 @@
TEST_F(FirmwareHandlerUpdateCompletedTest,
CallingStatSessionAfterCompletedFailureReturnsStateWithoutRechecking)
{
- getToUpdateCompleted(UpdateStatus::failed);
+ getToUpdateCompleted(ActionStatus::failed);
EXPECT_CALL(*updateMockPtr, status()).Times(0);
blobs::BlobMeta meta, expectedMeta = {};
expectedMeta.size = 0;
expectedMeta.blobState = flags | blobs::StateFlags::commit_error;
expectedMeta.metadata.push_back(
- static_cast<std::uint8_t>(UpdateStatus::failed));
+ static_cast<std::uint8_t>(ActionStatus::failed));
EXPECT_TRUE(handler->stat(session, &meta));
EXPECT_EQ(expectedMeta, meta);
diff --git a/test/firmware_state_updatepending_unittest.cpp b/test/firmware_state_updatepending_unittest.cpp
index 87df67d..00bdc2a 100644
--- a/test/firmware_state_updatepending_unittest.cpp
+++ b/test/firmware_state_updatepending_unittest.cpp
@@ -195,7 +195,7 @@
expectedMeta.size = 0;
expectedMeta.blobState = flags;
expectedMeta.metadata.push_back(
- static_cast<std::uint8_t>(UpdateStatus::unknown));
+ static_cast<std::uint8_t>(ActionStatus::unknown));
EXPECT_TRUE(handler->stat(session, &meta));
EXPECT_EQ(expectedMeta, meta);
diff --git a/test/firmware_state_updatestarted_unittest.cpp b/test/firmware_state_updatestarted_unittest.cpp
index e2348e4..6b55b4e 100644
--- a/test/firmware_state_updatestarted_unittest.cpp
+++ b/test/firmware_state_updatestarted_unittest.cpp
@@ -158,17 +158,17 @@
* stat(session) - this will trigger a check, and the state may change.
*/
TEST_F(FirmwareHandlerUpdateStartedTest,
- CallStatChecksUpdateStatusReturnsRunningDoesNotChangeState)
+ CallStatChecksActionStatusReturnsRunningDoesNotChangeState)
{
getToUpdateStarted();
EXPECT_CALL(*updateMockPtr, status())
- .WillOnce(Return(UpdateStatus::running));
+ .WillOnce(Return(ActionStatus::running));
blobs::BlobMeta meta, expectedMeta = {};
expectedMeta.size = 0;
expectedMeta.blobState = flags | blobs::StateFlags::committing;
expectedMeta.metadata.push_back(
- static_cast<std::uint8_t>(UpdateStatus::running));
+ static_cast<std::uint8_t>(ActionStatus::running));
EXPECT_TRUE(handler->stat(session, &meta));
EXPECT_EQ(expectedMeta, meta);
@@ -176,17 +176,17 @@
}
TEST_F(FirmwareHandlerUpdateStartedTest,
- CallStatChecksUpdateStatusReturnsFailedChangesStateToCompleted)
+ CallStatChecksActionStatusReturnsFailedChangesStateToCompleted)
{
getToUpdateStarted();
EXPECT_CALL(*updateMockPtr, status())
- .WillOnce(Return(UpdateStatus::failed));
+ .WillOnce(Return(ActionStatus::failed));
blobs::BlobMeta meta, expectedMeta = {};
expectedMeta.size = 0;
expectedMeta.blobState = flags | blobs::StateFlags::commit_error;
expectedMeta.metadata.push_back(
- static_cast<std::uint8_t>(UpdateStatus::failed));
+ static_cast<std::uint8_t>(ActionStatus::failed));
EXPECT_TRUE(handler->stat(session, &meta));
EXPECT_EQ(expectedMeta, meta);
@@ -194,17 +194,17 @@
}
TEST_F(FirmwareHandlerUpdateStartedTest,
- CallStatChecksUpdateStatusReturnsSuccessChangesStateToCompleted)
+ CallStatChecksActionStatusReturnsSuccessChangesStateToCompleted)
{
getToUpdateStarted();
EXPECT_CALL(*updateMockPtr, status())
- .WillOnce(Return(UpdateStatus::success));
+ .WillOnce(Return(ActionStatus::success));
blobs::BlobMeta meta, expectedMeta = {};
expectedMeta.size = 0;
expectedMeta.blobState = flags | blobs::StateFlags::committed;
expectedMeta.metadata.push_back(
- static_cast<std::uint8_t>(UpdateStatus::success));
+ static_cast<std::uint8_t>(ActionStatus::success));
EXPECT_TRUE(handler->stat(session, &meta));
EXPECT_EQ(expectedMeta, meta);
diff --git a/test/firmware_state_verificationcompleted_unittest.cpp b/test/firmware_state_verificationcompleted_unittest.cpp
index 3c9f34d..90338f0 100644
--- a/test/firmware_state_verificationcompleted_unittest.cpp
+++ b/test/firmware_state_verificationcompleted_unittest.cpp
@@ -59,14 +59,14 @@
* consistent behavior with verifyBlobId only added when closing the image
* or hash.
*/
- getToVerificationCompleted(VerifyCheckResponses::success);
+ getToVerificationCompleted(ActionStatus::success);
EXPECT_FALSE(handler->canHandleBlob(updateBlobId));
}
TEST_F(FirmwareHandlerVerificationCompletedTest,
OnVerificationCompleteFailureUpdateBlobIdNotPresent)
{
- getToVerificationCompleted(VerifyCheckResponses::failed);
+ getToVerificationCompleted(ActionStatus::failed);
EXPECT_FALSE(handler->canHandleBlob(updateBlobId));
}
@@ -75,7 +75,7 @@
*/
TEST_F(FirmwareHandlerVerificationCompletedTest, GetBlobIdsReturnsExpectedList)
{
- getToVerificationCompleted(VerifyCheckResponses::success);
+ getToVerificationCompleted(ActionStatus::success);
std::vector<std::string> expected = {verifyBlobId, hashBlobId,
activeImageBlobId, staticLayoutBlobId};
EXPECT_THAT(handler->getBlobIds(), UnorderedElementsAreArray(expected));
@@ -87,7 +87,7 @@
TEST_F(FirmwareHandlerVerificationCompletedTest,
StatOnActiveImageReturnsFailure)
{
- getToVerificationCompleted(VerifyCheckResponses::success);
+ getToVerificationCompleted(ActionStatus::success);
ASSERT_TRUE(handler->canHandleBlob(activeImageBlobId));
blobs::BlobMeta meta;
@@ -100,7 +100,7 @@
/* The path taken to get to this state never opened the hash blob Id, which
* is fine. But let's verify it behaved as intended.
*/
- getToVerificationCompleted(VerifyCheckResponses::success);
+ getToVerificationCompleted(ActionStatus::success);
EXPECT_FALSE(handler->canHandleBlob(activeHashBlobId));
}
@@ -113,7 +113,7 @@
TEST_F(FirmwareHandlerVerificationCompletedTest, StatOnVerifyBlobReturnsFailure)
{
- getToVerificationCompleted(VerifyCheckResponses::success);
+ getToVerificationCompleted(ActionStatus::success);
ASSERT_TRUE(handler->canHandleBlob(verifyBlobId));
blobs::BlobMeta meta;
@@ -123,7 +123,7 @@
TEST_F(FirmwareHandlerVerificationCompletedTest,
StatOnNormalBlobsReturnsSuccess)
{
- getToVerificationCompleted(VerifyCheckResponses::success);
+ getToVerificationCompleted(ActionStatus::success);
blobs::BlobMeta expected;
expected.blobState = FirmwareBlobHandler::UpdateFlags::ipmi;
@@ -150,14 +150,14 @@
/* Every time you stat() once it's triggered, it checks the state again
* until it's completed.
*/
- getToVerificationCompleted(VerifyCheckResponses::success);
+ getToVerificationCompleted(ActionStatus::success);
EXPECT_CALL(*verifyMockPtr, status()).Times(0);
blobs::BlobMeta meta, expectedMeta = {};
expectedMeta.size = 0;
expectedMeta.blobState = flags | blobs::StateFlags::committed;
expectedMeta.metadata.push_back(
- static_cast<std::uint8_t>(VerifyCheckResponses::success));
+ static_cast<std::uint8_t>(ActionStatus::success));
EXPECT_TRUE(handler->stat(session, &meta));
EXPECT_EQ(expectedMeta, meta);
@@ -167,14 +167,14 @@
TEST_F(FirmwareHandlerVerificationCompletedTest,
SessionStatOnVerifyAfterFailureDoesNothing)
{
- getToVerificationCompleted(VerifyCheckResponses::failed);
+ getToVerificationCompleted(ActionStatus::failed);
EXPECT_CALL(*verifyMockPtr, status()).Times(0);
blobs::BlobMeta meta, expectedMeta = {};
expectedMeta.size = 0;
expectedMeta.blobState = flags | blobs::StateFlags::commit_error;
expectedMeta.metadata.push_back(
- static_cast<std::uint8_t>(VerifyCheckResponses::failed));
+ static_cast<std::uint8_t>(ActionStatus::failed));
EXPECT_TRUE(handler->stat(session, &meta));
EXPECT_EQ(expectedMeta, meta);
@@ -187,7 +187,7 @@
TEST_F(FirmwareHandlerVerificationCompletedTest,
OpeningAnyBlobAvailableFailsAfterSuccess)
{
- getToVerificationCompleted(VerifyCheckResponses::success);
+ getToVerificationCompleted(ActionStatus::success);
auto blobs = handler->getBlobIds();
for (const auto& blob : blobs)
@@ -199,7 +199,7 @@
TEST_F(FirmwareHandlerVerificationCompletedTest,
OpeningAnyBlobAvailableFailsAfterFailure)
{
- getToVerificationCompleted(VerifyCheckResponses::failed);
+ getToVerificationCompleted(ActionStatus::failed);
auto blobs = handler->getBlobIds();
for (const auto& blob : blobs)
@@ -214,7 +214,7 @@
TEST_F(FirmwareHandlerVerificationCompletedTest,
WriteMetaToVerifyBlobReturnsFailure)
{
- getToVerificationCompleted(VerifyCheckResponses::success);
+ getToVerificationCompleted(ActionStatus::success);
std::vector<std::uint8_t> bytes = {0x01, 0x02};
EXPECT_FALSE(handler->writeMeta(session, 0, bytes));
@@ -226,7 +226,7 @@
TEST_F(FirmwareHandlerVerificationCompletedTest,
WriteToVerifyBlobReturnsFailure)
{
- getToVerificationCompleted(VerifyCheckResponses::success);
+ getToVerificationCompleted(ActionStatus::success);
std::vector<std::uint8_t> bytes = {0x01, 0x02};
EXPECT_FALSE(handler->write(session, 0, bytes));
@@ -237,7 +237,7 @@
*/
TEST_F(FirmwareHandlerVerificationCompletedTest, ReadOfVerifyBlobReturnsEmpty)
{
- getToVerificationCompleted(VerifyCheckResponses::success);
+ getToVerificationCompleted(ActionStatus::success);
EXPECT_THAT(handler->read(session, 0, 1), IsEmpty());
}
@@ -250,7 +250,7 @@
/* If you've started this'll return success, but if it's finished, it won't
* let you try-again.
*/
- getToVerificationCompleted(VerifyCheckResponses::success);
+ getToVerificationCompleted(ActionStatus::success);
EXPECT_CALL(*verifyMockPtr, triggerVerification()).Times(0);
EXPECT_FALSE(handler->commit(session, {}));
@@ -259,7 +259,7 @@
TEST_F(FirmwareHandlerVerificationCompletedTest,
CommitOnVerifyBlobAfterFailureReturnsFailure)
{
- getToVerificationCompleted(VerifyCheckResponses::failed);
+ getToVerificationCompleted(ActionStatus::failed);
EXPECT_CALL(*verifyMockPtr, triggerVerification()).Times(0);
EXPECT_FALSE(handler->commit(session, {}));
@@ -272,7 +272,7 @@
TEST_F(FirmwareHandlerVerificationCompletedTest,
CloseAfterSuccessChangesStateAddsUpdateBlob)
{
- getToVerificationCompleted(VerifyCheckResponses::success);
+ getToVerificationCompleted(ActionStatus::success);
ASSERT_FALSE(handler->canHandleBlob(updateBlobId));
handler->close(session);
diff --git a/test/firmware_state_verificationpending_unittest.cpp b/test/firmware_state_verificationpending_unittest.cpp
index b96ecb3..d22b887 100644
--- a/test/firmware_state_verificationpending_unittest.cpp
+++ b/test/firmware_state_verificationpending_unittest.cpp
@@ -216,7 +216,7 @@
expectedMeta.size = 0;
expectedMeta.blobState = flags;
expectedMeta.metadata.push_back(
- static_cast<std::uint8_t>(VerifyCheckResponses::other));
+ static_cast<std::uint8_t>(ActionStatus::unknown));
EXPECT_TRUE(handler->stat(session, &meta));
EXPECT_EQ(expectedMeta, meta);
diff --git a/test/firmware_state_verificationstarted_unittest.cpp b/test/firmware_state_verificationstarted_unittest.cpp
index e031fe3..03ceb99 100644
--- a/test/firmware_state_verificationstarted_unittest.cpp
+++ b/test/firmware_state_verificationstarted_unittest.cpp
@@ -71,13 +71,13 @@
{
getToVerificationStarted(staticLayoutBlobId);
EXPECT_CALL(*verifyMockPtr, status())
- .WillOnce(Return(VerifyCheckResponses::running));
+ .WillOnce(Return(ActionStatus::running));
blobs::BlobMeta meta, expectedMeta = {};
expectedMeta.size = 0;
expectedMeta.blobState = flags | blobs::StateFlags::committing;
expectedMeta.metadata.push_back(
- static_cast<std::uint8_t>(VerifyCheckResponses::running));
+ static_cast<std::uint8_t>(ActionStatus::running));
EXPECT_TRUE(handler->stat(session, &meta));
EXPECT_EQ(expectedMeta, meta);
@@ -88,13 +88,13 @@
{
getToVerificationStarted(staticLayoutBlobId);
EXPECT_CALL(*verifyMockPtr, status())
- .WillOnce(Return(VerifyCheckResponses::other));
+ .WillOnce(Return(ActionStatus::unknown));
blobs::BlobMeta meta, expectedMeta = {};
expectedMeta.size = 0;
expectedMeta.blobState = flags | blobs::StateFlags::committing;
expectedMeta.metadata.push_back(
- static_cast<std::uint8_t>(VerifyCheckResponses::other));
+ static_cast<std::uint8_t>(ActionStatus::unknown));
EXPECT_TRUE(handler->stat(session, &meta));
EXPECT_EQ(expectedMeta, meta);
@@ -108,13 +108,13 @@
*/
getToVerificationStarted(staticLayoutBlobId);
EXPECT_CALL(*verifyMockPtr, status())
- .WillOnce(Return(VerifyCheckResponses::failed));
+ .WillOnce(Return(ActionStatus::failed));
blobs::BlobMeta meta, expectedMeta = {};
expectedMeta.size = 0;
expectedMeta.blobState = flags | blobs::StateFlags::commit_error;
expectedMeta.metadata.push_back(
- static_cast<std::uint8_t>(VerifyCheckResponses::failed));
+ static_cast<std::uint8_t>(ActionStatus::failed));
EXPECT_TRUE(handler->stat(session, &meta));
EXPECT_EQ(expectedMeta, meta);
@@ -129,13 +129,13 @@
*/
getToVerificationStarted(staticLayoutBlobId);
EXPECT_CALL(*verifyMockPtr, status())
- .WillOnce(Return(VerifyCheckResponses::success));
+ .WillOnce(Return(ActionStatus::success));
blobs::BlobMeta meta, expectedMeta = {};
expectedMeta.size = 0;
expectedMeta.blobState = flags | blobs::StateFlags::committed;
expectedMeta.metadata.push_back(
- static_cast<std::uint8_t>(VerifyCheckResponses::success));
+ static_cast<std::uint8_t>(ActionStatus::success));
EXPECT_TRUE(handler->stat(session, &meta));
EXPECT_EQ(expectedMeta, meta);
diff --git a/test/firmware_unittest.hpp b/test/firmware_unittest.hpp
index 947c2ba..11d49bf 100644
--- a/test/firmware_unittest.hpp
+++ b/test/firmware_unittest.hpp
@@ -75,7 +75,7 @@
expectedState(FirmwareBlobHandler::UpdateState::verificationStarted);
}
- void getToVerificationCompleted(VerifyCheckResponses checkResponse)
+ void getToVerificationCompleted(ActionStatus checkResponse)
{
getToVerificationStarted(staticLayoutBlobId);
@@ -87,7 +87,7 @@
void getToUpdatePending()
{
- getToVerificationCompleted(VerifyCheckResponses::success);
+ getToVerificationCompleted(ActionStatus::success);
handler->close(session);
expectedState(FirmwareBlobHandler::UpdateState::updatePending);
@@ -103,7 +103,7 @@
expectedState(FirmwareBlobHandler::UpdateState::updateStarted);
}
- void getToUpdateCompleted(UpdateStatus result)
+ void getToUpdateCompleted(ActionStatus result)
{
getToUpdateStarted();
EXPECT_CALL(*updateMockPtr, status()).WillOnce(Return(result));
diff --git a/test/tools_updater_unittest.cpp b/test/tools_updater_unittest.cpp
index 95a5abc..cacf2b0 100644
--- a/test/tools_updater_unittest.cpp
+++ b/test/tools_updater_unittest.cpp
@@ -130,7 +130,7 @@
verificationResponse.blob_state = supported | blobs::StateFlags::committing;
verificationResponse.size = 0;
verificationResponse.metadata.push_back(static_cast<std::uint8_t>(
- ipmi_flash::FirmwareBlobHandler::VerifyCheckResponses::success));
+ ipmi_flash::FirmwareBlobHandler::ActionStatus::success));
EXPECT_CALL(blobMock, getStat(TypedEq<std::uint16_t>(session)))
.WillOnce(Return(verificationResponse));
diff --git a/test/verification_mock.hpp b/test/verification_mock.hpp
index b3071ef..728411b 100644
--- a/test/verification_mock.hpp
+++ b/test/verification_mock.hpp
@@ -16,7 +16,7 @@
public:
MOCK_METHOD0(triggerVerification, bool());
MOCK_METHOD0(abortVerification, void());
- MOCK_METHOD0(status, VerifyCheckResponses());
+ MOCK_METHOD0(status, ActionStatus());
};
std::unique_ptr<VerificationInterface> CreateVerifyMock()
diff --git a/tools/updater.cpp b/tools/updater.cpp
index 0819c80..98ef86e 100644
--- a/tools/updater.cpp
+++ b/tools/updater.cpp
@@ -114,8 +114,7 @@
using namespace std::chrono_literals;
static constexpr auto verificationSleep = 5s;
- ipmi_flash::VerifyCheckResponses result =
- ipmi_flash::VerifyCheckResponses::other;
+ ipmi_flash::ActionStatus result = ipmi_flash::ActionStatus::unknown;
try
{
@@ -138,22 +137,21 @@
std::fprintf(stderr, "Received invalid metadata response!!!\n");
}
- result =
- static_cast<ipmi_flash::VerifyCheckResponses>(resp.metadata[0]);
+ result = static_cast<ipmi_flash::ActionStatus>(resp.metadata[0]);
switch (result)
{
- case ipmi_flash::VerifyCheckResponses::failed:
+ case ipmi_flash::ActionStatus::failed:
std::fprintf(stderr, "failed\n");
exitLoop = true;
break;
- case ipmi_flash::VerifyCheckResponses::other:
+ case ipmi_flash::ActionStatus::unknown:
std::fprintf(stderr, "other\n");
break;
- case ipmi_flash::VerifyCheckResponses::running:
+ case ipmi_flash::ActionStatus::running:
std::fprintf(stderr, "running\n");
break;
- case ipmi_flash::VerifyCheckResponses::success:
+ case ipmi_flash::ActionStatus::success:
std::fprintf(stderr, "success\n");
exitLoop = true;
break;
@@ -183,7 +181,7 @@
* which exceptions from the lower layers allow one to try and delete the
* blobs to rollback the state and progress.
*/
- return (result == ipmi_flash::VerifyCheckResponses::success);
+ return (result == ipmi_flash::ActionStatus::success);
}
bool UpdateHandler::verifyFile(const std::string& target)
diff --git a/update.hpp b/update.hpp
index 99dd9ca..8f2b03f 100644
--- a/update.hpp
+++ b/update.hpp
@@ -21,7 +21,7 @@
virtual void abortUpdate() = 0;
/** Check the current state of the update process. */
- virtual UpdateStatus status() = 0;
+ virtual ActionStatus status() = 0;
};
} // namespace ipmi_flash
diff --git a/update_systemd.cpp b/update_systemd.cpp
index 0802f43..e81b2bc 100644
--- a/update_systemd.cpp
+++ b/update_systemd.cpp
@@ -68,10 +68,10 @@
return;
}
-UpdateStatus SystemdUpdateMechanism::status()
+ActionStatus SystemdUpdateMechanism::status()
{
/* For now, don't check if the target failed. */
- return UpdateStatus::running;
+ return ActionStatus::running;
}
} // namespace ipmi_flash
diff --git a/update_systemd.hpp b/update_systemd.hpp
index 47c8d67..693beb4 100644
--- a/update_systemd.hpp
+++ b/update_systemd.hpp
@@ -35,7 +35,7 @@
bool triggerUpdate() override;
void abortUpdate() override;
- UpdateStatus status() override;
+ ActionStatus status() override;
private:
sdbusplus::bus::bus bus;
diff --git a/verify.hpp b/verify.hpp
index d7574de..6c70d54 100644
--- a/verify.hpp
+++ b/verify.hpp
@@ -24,7 +24,7 @@
virtual void abortVerification() = 0;
/** Check the current state of the verification process. */
- virtual VerifyCheckResponses status() = 0;
+ virtual ActionStatus status() = 0;
};
} // namespace ipmi_flash
diff --git a/verify_systemd.cpp b/verify_systemd.cpp
index 11386e0..73d9f24 100644
--- a/verify_systemd.cpp
+++ b/verify_systemd.cpp
@@ -67,9 +67,9 @@
/* TODO: Implement this. */
}
-VerifyCheckResponses SystemdVerification::status()
+ActionStatus SystemdVerification::status()
{
- VerifyCheckResponses result = VerifyCheckResponses::other;
+ ActionStatus result = ActionStatus::unknown;
std::ifstream ifs;
ifs.open(checkPath);
@@ -83,15 +83,15 @@
ifs >> status;
if (status == "running")
{
- result = VerifyCheckResponses::running;
+ result = ActionStatus::running;
}
else if (status == "success")
{
- result = VerifyCheckResponses::success;
+ result = ActionStatus::success;
}
else if (status == "failed")
{
- result = VerifyCheckResponses::failed;
+ result = ActionStatus::failed;
}
}
diff --git a/verify_systemd.hpp b/verify_systemd.hpp
index 5e63e63..9b2cbab 100644
--- a/verify_systemd.hpp
+++ b/verify_systemd.hpp
@@ -47,7 +47,7 @@
bool triggerVerification() override;
void abortVerification() override;
- VerifyCheckResponses status() override;
+ ActionStatus status() override;
private:
sdbusplus::bus::bus bus;