summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam A. Kennington III <wak@google.com>2018-02-02 16:00:50 -0800
committerWilliam A. Kennington III <wak@google.com>2018-02-21 12:16:06 -0800
commit93975266189868dac12ebbe207cb3f0c3f4919c0 (patch)
tree7e7a8babf67e18f7fbd5f7d27272ddd0e3fe10ab
parent1232a151514f722bc13e4e0165f3dd02dc63de2a (diff)
downloadphosphor-watchdog-93975266189868dac12ebbe207cb3f0c3f4919c0.tar.gz
phosphor-watchdog-93975266189868dac12ebbe207cb3f0c3f4919c0.zip
mainapp: Print out the action -> target map at startup
We have multiple methods for setting the action to systemd target mappings on the command line. This makes it more clear to the end user what the daemon interprets as the final mapping when it starts up. Change-Id: Ib57dc04575a578bba54f5bf8cb47d6a61690d3a3 Signed-off-by: William A. Kennington III <wak@google.com>
-rw-r--r--mainapp.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/mainapp.cpp b/mainapp.cpp
index 6cc3fdf..bf60c88 100644
--- a/mainapp.cpp
+++ b/mainapp.cpp
@@ -18,12 +18,14 @@
#include <phosphor-logging/log.hpp>
#include <phosphor-logging/elog.hpp>
#include <phosphor-logging/elog-errors.hpp>
+#include <string>
#include <xyz/openbmc_project/Common/error.hpp>
#include "argument.hpp"
#include "watchdog.hpp"
using phosphor::watchdog::ArgumentParser;
using phosphor::watchdog::Watchdog;
+using sdbusplus::xyz::openbmc_project::State::server::convertForMessage;
static void exitWithError(const char* err, char** argv)
{
@@ -32,6 +34,18 @@ static void exitWithError(const char* err, char** argv)
exit(EXIT_FAILURE);
}
+void printActionTargets(
+ const std::map<Watchdog::Action, std::string>& actionTargets)
+{
+ std::cerr << "Action Targets:\n";
+ for (const auto& actionTarget : actionTargets)
+ {
+ std::cerr << " " << convertForMessage(actionTarget.first) << " -> " <<
+ actionTarget.second << "\n";
+ }
+ std::cerr << std::flush;
+}
+
int main(int argc, char** argv)
{
using namespace phosphor::logging;
@@ -89,6 +103,8 @@ int main(int argc, char** argv)
actionTargets[Watchdog::Action::PowerCycle] = target;
}
+ printActionTargets(actionTargets);
+
sd_event* event = nullptr;
auto r = sd_event_default(&event);
if (r < 0)
OpenPOWER on IntegriCloud