control:fanctl: `reload` option only for JSON
Similar to how the `dump` option is completely removed when not JSON
configuration based, only show the `reload` option when JSON is enabled.
There is no support for reloading a YAML based configuration, so this
change removes the `reload` option over the previous error message that
was returned.
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
Change-Id: Idab7903edf429051b80d4a766fd8201514663eb6
diff --git a/control/fanctl.cpp b/control/fanctl.cpp
index cd37ca4..3496b3c 100644
--- a/control/fanctl.cpp
+++ b/control/fanctl.cpp
@@ -515,7 +515,6 @@
*/
void reload()
{
-#ifdef CONTROL_USE_JSON
try
{
SDBusPlus::callMethod(systemdService, systemdPath, systemdMgrIface,
@@ -526,11 +525,6 @@
std::cerr << "Unable to reload configuration files: " << e.what()
<< std::endl;
}
-#else
- // YAML config doesn't support SIGHUP-based reloads
- std::cerr << "Error: reload function unavailable for YAML-configuration"
- << std::endl;
-#endif
}
/**
@@ -662,10 +656,12 @@
"[optional] list of 1+ fans to set target RPM/PWM (default: all)");
cmdSet->require_option();
+#ifdef CONTROL_USE_JSON
strHelp = "Reload phosphor-fan configuration files";
auto cmdReload = commands->add_subcommand("reload", strHelp);
cmdReload->set_help_flag("-h, --help", strHelp);
cmdReload->require_option(0);
+#endif
strHelp = "Resume running phosphor-fan-control";
auto cmdResume = commands->add_subcommand("resume", strHelp);
@@ -725,10 +721,12 @@
{
set(target, fanList);
}
+#ifdef CONTROL_USE_JSON
else if (app.got_subcommand("reload"))
{
reload();
}
+#endif
else if (app.got_subcommand("resume"))
{
resume();