From c30c73c72658c69385209e36e45a1dd08c8f0655 Mon Sep 17 00:00:00 2001 From: cjhardee <cjhardee@8638fb3e-16cb-4fca-ae20-7b5d299a9bcd> Date: Thu, 30 Aug 2012 15:01:58 +0000 Subject: [PATCH] Allowed the put data to be passed in the query string for table puts and patches git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@13667 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/xCAT-wsapi/xcatws.cgi | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/xCAT-server/xCAT-wsapi/xcatws.cgi b/xCAT-server/xCAT-wsapi/xcatws.cgi index 638bef793..e394a8973 100755 --- a/xCAT-server/xCAT-wsapi/xcatws.cgi +++ b/xCAT-server/xCAT-wsapi/xcatws.cgi @@ -1297,12 +1297,31 @@ sub tablesHandler { } elsif (isPut() || isPatch()) { my $condition = $q->param('condition'); + if (!defined $condition) { + foreach my $put (@{$queryhash{'putData'}}) { + my ($key, $value) = split(/=/, $put, 2); + if ($key eq 'condition' && $value) { + $condition = $value; + } + } + } + if (!defined $table || !defined $condition) { addPageContent("The table and condition must be specified when adding, changing or deleting an entry"); sendResponseMsg($STATUS_BAD_REQUEST); } $request->{command} = 'tabch'; - if (defined $q->param('delete')) { + my $del; + if (!defined $q->param('delete')) { + foreach my $put (@{$queryhash{'putData'}}) { + my ($key, $value) = split(/=/, $put, 2); + if ($key eq 'delete') { + $del = 1; + } + } + } + + if (defined $q->param('delete') || defined $del) { push @args, '-d'; push @args, $condition; push @args, $table;