util::dbus: Make common the autorebootEnabled code

Move the code for checking autoreboot property from attention handler
specific code to common utility dbus code.

Signed-off-by: Ben Tyner <ben.tyner@ibm.com>
Change-Id: Ia2b5e4bd3d7baa57ca46600cb5ed150144d5728e
diff --git a/attn/ti_handler.cpp b/attn/ti_handler.cpp
index fb0893f..de692ac 100644
--- a/attn/ti_handler.cpp
+++ b/attn/ti_handler.cpp
@@ -98,7 +98,7 @@
 
     // We are finished creating the event log entries so transition host to
     // the required state.
-    if (autoRebootEnabled())
+    if (true == util::dbus::autoRebootEnabled())
     {
         // If autoreboot is enabled we will start crash (mpipl) mode target
         util::dbus::transitionHost(util::dbus::HostState::Crash);
@@ -392,39 +392,6 @@
     }
 }
 
-/** @brief Read state of autoreboot propertyi via dbus */
-bool autoRebootEnabled()
-{
-    // Use dbus get-property interface to read the autoreboot property
-    auto bus = sdbusplus::bus::new_system();
-    auto method =
-        bus.new_method_call("xyz.openbmc_project.Settings",
-                            "/xyz/openbmc_project/control/host0/auto_reboot",
-                            "org.freedesktop.DBus.Properties", "Get");
-
-    method.append("xyz.openbmc_project.Control.Boot.RebootPolicy",
-                  "AutoReboot");
-
-    bool autoReboot = false; // assume autoreboot attribute not available
-
-    try
-    {
-        auto reply = bus.call(method);
-
-        std::variant<bool> result;
-        reply.read(result);
-        autoReboot = std::get<bool>(result);
-    }
-    catch (const sdbusplus::exception::SdBusError& e)
-    {
-        trace<level::INFO>("autoRebootEnbabled exception");
-        std::string traceMsg = std::string(e.what(), maxTraceLen);
-        trace<level::ERROR>(traceMsg.c_str());
-    }
-
-    return autoReboot;
-}
-
 /**
  *  Callback for dump request properties change signal monitor
  *