Pass in the version purpose.

Since this will handle both the host and the bmc images,
need to be able to pass in the version purpose.

Change-Id: If09b3b81d9dc6166c61a4780ddaed7e1bdc021d0
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/version.cpp b/version.cpp
index 9c86756..4260a89 100644
--- a/version.cpp
+++ b/version.cpp
@@ -15,10 +15,11 @@
 
 using namespace phosphor::logging;
 
-std::string Version::getVersion(const std::string& manifestFilePath)
+std::string Version::getValue(const std::string& manifestFilePath,
+                              std::string key)
 {
-    constexpr auto versionKey = "version=";
-    constexpr auto versionKeySize = strlen(versionKey);
+    key = key + "=";
+    auto keySize = key.length();
 
     if (manifestFilePath.empty())
     {
@@ -26,7 +27,7 @@
         throw std::runtime_error("MANIFESTFilePath is empty");
     }
 
-    std::string version{};
+    std::string value{};
     std::ifstream efile;
     std::string line;
     efile.exceptions(std::ifstream::failbit
@@ -39,9 +40,9 @@
         efile.open(manifestFilePath);
         while (getline(efile, line))
         {
-            if (line.compare(0, versionKeySize, versionKey) == 0)
+            if (line.compare(0, keySize, key) == 0)
             {
-                version = line.substr(versionKeySize);
+                value = line.substr(keySize);
                 break;
             }
         }
@@ -49,10 +50,10 @@
     }
     catch (const std::exception& e)
     {
-        log<level::ERR>("Error in reading Host MANIFEST file");
+        log<level::ERR>("Error in reading MANIFEST file");
     }
 
-    return version;
+    return value;
 }
 
 std::string Version::getId(const std::string& version)
@@ -61,8 +62,8 @@
 
     if (version.empty())
     {
-        log<level::ERR>("Error Host version is empty");
-        throw std::runtime_error("Host version is empty");
+        log<level::ERR>("Error version is empty");
+        throw std::runtime_error("Version is empty");
     }
 
     // Only want 8 hex digits.