You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by pr...@apache.org on 2013/02/11 20:34:04 UTC

[1/2] git commit: refs/heads/4.1 - CLOUDSTACK-1120 [EC2 Query API] Parameter 'keynames' is not honoured by DescribeKeyPairs

CLOUDSTACK-1120 [EC2 Query API] Parameter 'keynames' is not honoured by DescribeKeyPairs

When EC2DesribeKeyPairs is called with filter 'keynames' it ignored the key-name provided and lists all the key-pairs


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/e63fc4c0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/e63fc4c0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/e63fc4c0

Branch: refs/heads/4.1
Commit: e63fc4c0cbc13d269508f66532992bdb7f1804de
Parents: 2b593dd
Author: Likitha Shetty <Li...@citrix.com>
Authored: Fri Feb 8 17:29:13 2013 -0800
Committer: Prachi Damle <pr...@cloud.com>
Committed: Mon Feb 11 11:23:53 2013 -0800

----------------------------------------------------------------------
 .../com/cloud/bridge/service/EC2RestServlet.java   |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e63fc4c0/awsapi/src/com/cloud/bridge/service/EC2RestServlet.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/service/EC2RestServlet.java b/awsapi/src/com/cloud/bridge/service/EC2RestServlet.java
index 0186db4..ca910e0 100644
--- a/awsapi/src/com/cloud/bridge/service/EC2RestServlet.java
+++ b/awsapi/src/com/cloud/bridge/service/EC2RestServlet.java
@@ -1678,13 +1678,16 @@ public class EC2RestServlet extends HttpServlet {
             throws ADBException, XMLStreamException, IOException {
         EC2DescribeKeyPairs ec2Request = new EC2DescribeKeyPairs();
 
-
-        String[] keyNames = request.getParameterValues( "KeyName" );
-        if (keyNames != null) { 
-            for (String keyName : keyNames) {
-                ec2Request.addKeyName(keyName);
+        Enumeration<?> names = request.getParameterNames();
+        while( names.hasMoreElements()) {
+            String key = (String)names.nextElement();
+            if (key.startsWith("KeyName")) {
+                String[] value = request.getParameterValues( key );
+                if (null != value && 0 < value.length)
+                    ec2Request.addKeyName(value[0]);
             }
         }
+
         EC2Filter[] filterSet = extractFilters( request );
         if (null != filterSet){
             EC2KeyPairFilterSet vfs = new EC2KeyPairFilterSet();