From 8cdde379022b2cebe324d91fb9931884c70820f7 Mon Sep 17 00:00:00 2001 From: ertaozh Date: Mon, 18 May 2015 01:49:26 -0400 Subject: [PATCH] fix bug that REST will return error message if no objection defined --- xCAT-server/xCAT-wsapi/xcatws.cgi | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/xCAT-server/xCAT-wsapi/xcatws.cgi b/xCAT-server/xCAT-wsapi/xcatws.cgi index f47de980b..7c31f6a35 100755 --- a/xCAT-server/xCAT-wsapi/xcatws.cgi +++ b/xCAT-server/xCAT-wsapi/xcatws.cgi @@ -1470,6 +1470,9 @@ sub defout { foreach my $l (@$lines) { if ($l =~ /No responses/) { # handle the case that no output from lsslp command return; + } elsif ($l =~ /Could not find any object definitions/) { + $json->{info} = $l; + last; } if ($l =~ /^Object name: / || $l =~ /^\S+:$/) { # start new node if ($l =~ /^Object name:\s+(\S+)/) { # handle the output of lsdef -t @@ -1517,6 +1520,9 @@ sub defout_remove_appended_type { foreach my $l (@$lines) { if ($l =~ /^(\S*)\s+\(.*\)$/) { # start new node push @{$json}, $1; + } elsif ($l =~ /Could not find any object definitions/) { + push @{$json}, $l; + last; } } } @@ -1883,7 +1889,7 @@ sub actionhdl { } elsif ($paramhash->{'value'}) { push @args, $urilayers[3]."=".$paramhash->{'value'}; } - if (defined($urilayers[3]) and $urilayers[3] =~ /^account/) { + if ((isPut() or isPost()) and defined($urilayers[3])) { foreach my $key (keys %$paramhash) { if (($key ne '') and (exists($paramhash->{$key}))) { push @args, $key."=".$paramhash->{$key};