std::variant: Fix use of incompatible api
Refactors any uses of the mapbox variant specific api and converts them
to an api compatible with std::variant and mapbox variant.
Tested:
Built and run through the unit test suite.
Change-Id: Ie9b83fd638c495859fe98b5de86d9d3c7c1a27af
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/host_state_manager.cpp b/host_state_manager.cpp
index 38c9469..aaac46c 100644
--- a/host_state_manager.cpp
+++ b/host_state_manager.cpp
@@ -162,14 +162,10 @@
}
result.read(currentState);
-
- if (currentState != ACTIVE_STATE && currentState != ACTIVATING_STATE)
- {
- // False - not active
- return false;
- }
- // True - active
- return true;
+ const auto& currentStateStr =
+ sdbusplus::message::variant_ns::get<std::string>(currentState);
+ return currentStateStr == ACTIVE_STATE ||
+ currentStateStr == ACTIVATING_STATE;
}
bool Host::isAutoReboot()
@@ -189,7 +185,7 @@
sdbusplus::message::variant<bool> result;
reply.read(result);
- auto autoReboot = result.get<bool>();
+ auto autoReboot = sdbusplus::message::variant_ns::get<bool>(result);
auto rebootCounterParam = reboot::RebootAttempts::attemptsLeft();
if (autoReboot)