tools: type field now matches the /flash/{type}
Instead of mapping one word to a pre-defined mapping of types, let the
host user specify any value.
A user shouldn't specify hash, or update, or something meaningful.
Perhaps this should be validated.
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: Icec103e0ade999d527923dcacb440086c93e175c
diff --git a/tools/updater.cpp b/tools/updater.cpp
index 96f38b1..0fcfe6f 100644
--- a/tools/updater.cpp
+++ b/tools/updater.cpp
@@ -38,12 +38,10 @@
const std::string& signaturePath,
const std::string& layoutType)
{
- static std::unordered_map<std::string, std::string> typesToBlob = {
- {"static", ipmi_flash::staticLayoutBlobId},
- {"ubitar", ipmi_flash::ubiTarballBlobId},
- {"bios", ipmi_flash::biosBlobId}};
- /* We know it's one of the above types already. */
- auto& layout = typesToBlob[layoutType];
+ /* TODO: validate the layoutType isn't a special value such as: 'update',
+ * 'verify', or 'hash'
+ */
+ std::string layout = "/flash/" + layoutType;
bool goalSupported = updater->checkAvailable(layout);
if (!goalSupported)