From b78515b8bcd5bc94705e90fefe9096ed86f536bc Mon Sep 17 00:00:00 2001 From: daniceexi Date: Tue, 3 Jun 2014 05:03:04 -0400 Subject: [PATCH] REST API: support keyword ALLRESOURCES for GET nodes,networks,osimage,policy --- xCAT-server/xCAT-wsapi/xcatws.cgi | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/xCAT-server/xCAT-wsapi/xcatws.cgi b/xCAT-server/xCAT-wsapi/xcatws.cgi index 72c8e6a89..b088bee6c 100755 --- a/xCAT-server/xCAT-wsapi/xcatws.cgi +++ b/xCAT-server/xCAT-wsapi/xcatws.cgi @@ -1414,7 +1414,7 @@ sub defout { } else { # just an attribute of the current node if (! $nodename) { error('improperly formatted lsdef output from xcatd', $STATUS_TEAPOT); } - my ($attr, $val) = $l =~ /^\s*(\S+?)=(.*)$/; + my ($attr, $val) = $l =~ /^\s*(\S+.*?)=(.*)$/; if (!defined($attr)) { error('improperly formatted lsdef output from xcatd', $STATUS_TEAPOT); } $json->{$nodename}->{$attr} = $val; } @@ -1645,7 +1645,14 @@ sub defhdl { # push the object name - node/noderange if (defined ($urilayers[1])) { - push @args, ('-o', $urilayers[1]); + if ($urilayers[1] eq "ALLRESOURCES") { + unless (isGET()) { + error("Keyword ALLRESOURCES is only supported for GET Action.",$STATUS_NOT_FOUND); + } + push @args, '-l'; + } else { + push @args, ('-o', $urilayers[1]); + } } # For the put/post which specifies attributes like mgt=ipmi groups=all