summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Geissler <geissonator@yahoo.com>2019-06-28 21:52:27 +0300
committerEd Tanous <ed.tanous@intel.com>2019-07-08 21:32:39 +0300
commite90c50528a87fd15a7ae3f6b49e0ab83b1873d0c (patch)
tree8a21a71cfdbdc7f76c20975c3559ca457667c79b
parent7ab06f49454378a9b5c1934f5e155a4f3c352fdb (diff)
downloadbmcweb-e90c50528a87fd15a7ae3f6b49e0ab83b1873d0c.tar.xz
Return active bmc fw version
Utilize the new utility interface to return the actively running BMC firmware image. The current code just returns the first instance it finds which is incorrect. Tested: cat /etc/os-release ID="openbmc-phosphor" NAME="Phosphor OpenBMC (Phosphor OpenBMC Project Reference Distro)" VERSION="2.7.0-dev" VERSION_ID="2.7.0-dev-1010-gb417d47" Before Change: curl -k -H "X-Auth-Token: $TOKEN" -X GET https://${BMC_IP}/redfish/v1/Managers/bmc | grep Firmware "FirmwareVersion": "2.7.0-dev-999-gfbdb73f" After Change: curl -k -H "X-Auth-Token: $TOKEN" -X GET https://${BMC_IP}/redfish/v1/Managers/bmc | grep Firmware "FirmwareVersion": "2.7.0-dev-1010-gb417d47", Resolves openbmc/bmcweb#38 Change-Id: I50388c7adfaed8938e3a927becbebd801f0f7673 Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
-rw-r--r--redfish-core/lib/managers.hpp46
1 files changed, 3 insertions, 43 deletions
diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp
index 60f88568fc..2e2dbf1e31 100644
--- a/redfish-core/lib/managers.hpp
+++ b/redfish-core/lib/managers.hpp
@@ -24,6 +24,7 @@
#include <dbus_utility.hpp>
#include <memory>
#include <sstream>
+#include <utils/fw_utils.hpp>
#include <utils/systemd_utils.hpp>
#include <variant>
@@ -1527,49 +1528,8 @@ class Manager : public Node
health->isManagersHealth = true;
health->populate();
- crow::connections::systemBus->async_method_call(
- [asyncResp](const boost::system::error_code ec,
- const dbus::utility::ManagedObjectType& resp) {
- if (ec)
- {
- BMCWEB_LOG_ERROR << "Error while getting Software Version";
- messages::internalError(asyncResp->res);
- return;
- }
-
- for (auto& objpath : resp)
- {
- for (auto& interface : objpath.second)
- {
- // If interface is
- // xyz.openbmc_project.Software.Version, this is
- // what we're looking for.
- if (interface.first ==
- "xyz.openbmc_project.Software.Version")
- {
- // Cut out everyting until last "/", ...
- for (auto& property : interface.second)
- {
- if (property.first == "Version")
- {
- const std::string* value =
- std::get_if<std::string>(
- &property.second);
- if (value == nullptr)
- {
- continue;
- }
- asyncResp->res
- .jsonValue["FirmwareVersion"] = *value;
- }
- }
- }
- }
- }
- },
- "xyz.openbmc_project.Software.BMC.Updater",
- "/xyz/openbmc_project/software",
- "org.freedesktop.DBus.ObjectManager", "GetManagedObjects");
+ fw_util::getActiveFwVersion(asyncResp, fw_util::bmcPurpose,
+ "FirmwareVersion");
auto pids = std::make_shared<GetPIDValues>(asyncResp);
pids->run();