From f0c881820dd52bc577a0be849427ad4f801d535f Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 29 Jan 2018 16:12:50 -0500 Subject: [PATCH] Provide error message should fping be missing --- xCAT-server/lib/xcat/plugins/nodestat.pm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/nodestat.pm b/xCAT-server/lib/xcat/plugins/nodestat.pm index 3dfb73b67..5a4f9aa45 100644 --- a/xCAT-server/lib/xcat/plugins/nodestat.pm +++ b/xCAT-server/lib/xcat/plugins/nodestat.pm @@ -797,7 +797,9 @@ sub process_request_port { my $node; my $fping; open($fping, "fping " . join(' ', @nodes) . " 2> /dev/null|") or die("Can't start fping: $!"); + my $havefping = 0; while (<$fping>) { + $havefping = 1; my %rsp; my $node = $_; $node =~ s/ .*//; @@ -810,6 +812,12 @@ sub process_request_port { $status->{$node}->{'status'} = "nosuchhost"; } } + unless ($havefping) { + my $rsp = {}; + $rsp->{error}->[0] = + "Unable to find fping on system, must install fping package to use nodestat -f"; + xCAT::MsgUtils->message("E", $rsp, $callback, 1); + } } return $status;