Support reading VERSION_ID without quotes

The VERSION_ID value in /etc/os-release recently had its surrounding
quotation marks removed.  Update the code to be able to read values out
of /etc/os-release either with or without quotes, and make it a utility
function so that it can be used in multiple places.

Props to the phosphor-bmc-code-mgmt repo for the elegant implementation.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I348625ba49214ab2977d9e70a4337299bef5ed3a

Change-Id: I9d201954a8116dfda32d096a347e150d93fbfb46
diff --git a/log_manager.cpp b/log_manager.cpp
index cbfe434..bcc94a5 100644
--- a/log_manager.cpp
+++ b/log_manager.cpp
@@ -6,6 +6,7 @@
 #include "elog_meta.hpp"
 #include "elog_serialize.hpp"
 #include "extensions.hpp"
+#include "util.hpp"
 
 #include <poll.h>
 #include <sys/inotify.h>
@@ -739,27 +740,14 @@
 
 std::string Manager::readFWVersion()
 {
-    std::string version;
-    std::ifstream versionFile{BMC_VERSION_FILE};
-    std::string line;
-    static constexpr auto VERSION_ID = "VERSION_ID=";
+    auto version = util::getOSReleaseValue("VERSION_ID");
 
-    while (std::getline(versionFile, line))
-    {
-        if (line.find(VERSION_ID) != std::string::npos)
-        {
-            auto pos = line.find_first_of('"') + 1;
-            version = line.substr(pos, line.find_last_of('"') - pos);
-            break;
-        }
-    }
-
-    if (version.empty())
+    if (!version)
     {
         log<level::ERR>("Unable to read BMC firmware version");
     }
 
-    return version;
+    return version.value_or("");
 }
 
 void Manager::create(const std::string& message, Entry::Level severity,