tools: remove stat() check for supported interface
If an unsupported interface is requested, the open() call will simply
fail.
Signed-off-by: Benjamin Fair <benjaminfair@google.com>
Change-Id: Iefd11657d957931873a4d20246d9ccdd791ba0e5
diff --git a/tools/handler.cpp b/tools/handler.cpp
index 711e2f3..dbaa53f 100644
--- a/tools/handler.cpp
+++ b/tools/handler.cpp
@@ -51,28 +51,6 @@
return false;
}
- /* Call stat on /flash/image (or /flash/tarball) and check if data interface
- * is supported.
- */
- ipmiblob::StatResponse stat;
-
- try
- {
- stat = blob->getStat(goalFirmware);
- }
- catch (const ipmiblob::BlobException& b)
- {
- std::fprintf(stderr, "Received exception '%s' on getStat\n", b.what());
- return false;
- }
-
- auto supported = handler->supportedType();
- if ((stat.blob_state & supported) == 0)
- {
- std::fprintf(stderr, "data interface selected not supported.\n");
- return false;
- }
-
return true;
}
diff --git a/tools/test/tools_updater_unittest.cpp b/tools/test/tools_updater_unittest.cpp
index 706a4c3..b9f80ad 100644
--- a/tools/test/tools_updater_unittest.cpp
+++ b/tools/test/tools_updater_unittest.cpp
@@ -31,19 +31,9 @@
TEST_F(UpdateHandlerTest, CheckAvailableSuccess)
{
- ipmiblob::StatResponse statObj = {};
- statObj.blob_state = ipmi_flash::FirmwareFlags::UpdateFlags::ipmi |
- ipmi_flash::FirmwareFlags::UpdateFlags::lpc;
-
EXPECT_CALL(blobMock, getBlobList())
.WillOnce(
Return(std::vector<std::string>({ipmi_flash::staticLayoutBlobId})));
- EXPECT_CALL(blobMock, getStat(TypedEq<const std::string&>(
- ipmi_flash::staticLayoutBlobId)))
- .WillOnce(Return(statObj));
-
- EXPECT_CALL(handlerMock, supportedType())
- .WillOnce(Return(ipmi_flash::FirmwareFlags::UpdateFlags::lpc));
EXPECT_TRUE(updater.checkAvailable(ipmi_flash::staticLayoutBlobId));
}
diff --git a/tools/updater.cpp b/tools/updater.cpp
index 25f7dab..8639edd 100644
--- a/tools/updater.cpp
+++ b/tools/updater.cpp
@@ -46,10 +46,10 @@
bool goalSupported = updater->checkAvailable(layout);
if (!goalSupported)
{
- throw ToolException("Goal firmware or interface not supported");
+ throw ToolException("Goal firmware not supported");
}
- /* Yay, our data handler is supported. */
+ /* Yay, our layout type is supported. */
try
{
/* Send over the firmware image. */