PEL: Add getLocationCode call to inv callout

Instead of getting the location code, PN, SN, and CCIN all in one
function call, split getting the location code into its own function.
This way, if there is a location code but not the VPD fields, we can
still have the location code in the callout.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I02f1b18319c34fffce79ad31da74e2114ceb5c95
diff --git a/extensions/openpower-pels/data_interface.cpp b/extensions/openpower-pels/data_interface.cpp
index 95de4bb..f84e80f 100644
--- a/extensions/openpower-pels/data_interface.cpp
+++ b/extensions/openpower-pels/data_interface.cpp
@@ -308,7 +308,6 @@
 }
 
 void DataInterface::getHWCalloutFields(const std::string& inventoryPath,
-                                       std::string& locationCode,
                                        std::string& fruPartNumber,
                                        std::string& ccin,
                                        std::string& serialNumber) const
@@ -320,13 +319,7 @@
     // will provide this info.  Any missing interfaces will result
     // in exceptions being thrown.
 
-    auto service = getService(inventoryPath, interface::locCode);
-
-    DBusValue locCode;
-    getProperty(service, inventoryPath, interface::locCode, "LocationCode",
-                locCode);
-
-    locationCode = std::get<std::string>(locCode);
+    auto service = getService(inventoryPath, interface::viniRecordVPD);
 
     auto properties =
         getAllProperties(service, inventoryPath, interface::viniRecordVPD);
@@ -341,5 +334,17 @@
     serialNumber = std::string{value.begin(), value.end()};
 }
 
+std::string
+    DataInterface::getLocationCode(const std::string& inventoryPath) const
+{
+    auto service = getService(inventoryPath, interface::locCode);
+
+    DBusValue locCode;
+    getProperty(service, inventoryPath, interface::locCode, "LocationCode",
+                locCode);
+
+    return std::get<std::string>(locCode);
+}
+
 } // namespace pels
 } // namespace openpower