From 1d40272cdb9e76d1259718e3027979f10f85ec26 Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Thu, 20 Oct 2011 03:27:28 +0000 Subject: [PATCH] fix bug item 3425252: rspconfig NODE BSR warning mesg improvement git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@10844 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/FSPcfg.pm | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/perl-xCAT/xCAT/FSPcfg.pm b/perl-xCAT/xCAT/FSPcfg.pm index 75cd7cc30..52d6e8e40 100644 --- a/perl-xCAT/xCAT/FSPcfg.pm +++ b/perl-xCAT/xCAT/FSPcfg.pm @@ -44,6 +44,23 @@ sub array_to_string { } return $string; } + +sub check_command { + my $cmd = shift; + my $rsp = shift; + my @type = (); + foreach my $tmp_type (keys %$rsp) { + if (grep (/^$cmd$/, @{$rsp->{$tmp_type}})) { + push @type, $tmp_type; + } + } + if (!scalar(@type)) { + return undef; + } else { + return &array_to_string(\@type); + } +} + sub parse_args { my $request = shift; @@ -172,7 +189,12 @@ sub parse_args { $request->{arg} = [$arg]; my $res = xCAT::PPCcfg::parse_args($request, @_); if (ref($res) eq 'ARRAY') { - return $res; + my $check_cmd = &check_command($command, \%rsp); + if (!defined($check_cmd)) { + return $res; + } else { + return ([$_[0], "'$command' is only supported by nodetype $check_cmd."]); + } } else { push @ppc_cmds, $command; }