From 3b6a4cd700a60a1e4c969900e87a5e58512ebc89 Mon Sep 17 00:00:00 2001 From: Adriana Kobylak Date: Mon, 10 Dec 2018 13:45:09 -0600 Subject: Remove deprecated is_method_error code The is_method_error() function is no longer needed, instead a try-catch block should be used instead. Reference: https://lists.ozlabs.org/pipermail/openbmc/2018-October/013696.html, Change-Id: I1919ea33fc18be2b8afd51fb1f85ddef15041e7c Signed-off-by: Adriana Kobylak --- activation.cpp | 8 +++++--- ubi/item_updater_helper.cpp | 18 ++++++++++++------ 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/activation.cpp b/activation.cpp index a938b8b..73acc3d 100644 --- a/activation.cpp +++ b/activation.cpp @@ -205,9 +205,11 @@ void Activation::deleteImageManagerObject() auto method = this->bus.new_method_call(VERSION_BUSNAME, path.c_str(), "xyz.openbmc_project.Object.Delete", "Delete"); - auto mapperResponseMsg = bus.call(method); - // Check that the bus call didn't result in an error - if (mapperResponseMsg.is_method_error()) + try + { + bus.call_noreply(method); + } + catch (const SdBusError& e) { log("Error in Deleting image from image manager", entry("VERSIONPATH=%s", path.c_str())); diff --git a/ubi/item_updater_helper.cpp b/ubi/item_updater_helper.cpp index 68162cb..a699d5f 100644 --- a/ubi/item_updater_helper.cpp +++ b/ubi/item_updater_helper.cpp @@ -3,6 +3,7 @@ #include "item_updater_helper.hpp" #include +#include namespace phosphor { @@ -12,6 +13,7 @@ namespace updater { using namespace phosphor::logging; +using sdbusplus::exception::SdBusError; void Helper::setEntry(const std::string& entryId, uint8_t value) { @@ -69,10 +71,12 @@ void Helper::updateUbootVersionId(const std::string& versionId) auto updateEnvVarsFile = "obmc-flash-bmc-updateubootvars@" + versionId + ".service"; method.append(updateEnvVarsFile, "replace"); - auto result = bus.call(method); - // Check that the bus call didn't result in an error - if (result.is_method_error()) + try + { + bus.call_noreply(method); + } + catch (const SdBusError& e) { log("Failed to update u-boot env variables", entry("VERSIONID=%s", versionId.c_str())); @@ -105,10 +109,12 @@ void Helper::mirrorAlt() SYSTEMD_INTERFACE, "StartUnit"); auto mirrorUbootFile = "obmc-flash-bmc-mirroruboot.service"; method.append(mirrorUbootFile, "replace"); - auto result = bus.call(method); - // Check that the bus call didn't result in an error - if (result.is_method_error()) + try + { + bus.call_noreply(method); + } + catch (const SdBusError& e) { log("Failed to copy U-Boot to alternate chip"); } -- cgit v1.2.1