From 57e90bbf96e1ca139de9d37cee2c3a14e9d2e406 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Mon, 20 Mar 2017 12:04:21 -0400 Subject: [PATCH] Move the unsupported function to the top and reword slightly --- xCAT-server/lib/xcat/plugins/openbmc.pm | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 505fe7588..8505125d0 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -24,6 +24,18 @@ use JSON; $::OPENBMC_DEVEL = $ENV{'OPENBMC_DEVEL'}; + +sub unsupported { + my $callback = shift; + if (defined($::OPENBMC_DEVEL) && ($::OPENBMC_DEVEL eq "YES")) { + xCAT::SvrUtils::sendmsg("Warning: Currently running development code, use at your own risk. Unset OPENBMC_DEVEL and `restartxcatd` to disable.\n", $callback); + return; + } else { + return ([ 1, "This openbmc related function is unsupported and disabled. To bypass, run the following: \n\texport OPENBMC_DEVEL=YES\n\trestartxcatd" ]); + } +} + + #------------------------------------------------------- =head3 handled_commands @@ -291,17 +303,6 @@ sub parse_args { return; } - -sub unsupported { - my $callback = shift; - if ($::OPENBMC_DEVEL ne "YES") { - return ([ 1, "This function is currently not supported\nTo enable development code, run the following commands:\n\nexport OPENBMC_DEVEL=YES\nrestartxcatd" ]); - } else { - xCAT::SvrUtils::sendmsg("Warning: Currently running development code, use at your own risk\n", $callback); - return; - } -} - #------------------------------------------------------- =head3 parse_command_status