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
This commit is contained in:
Likitha Shetty 2013-02-08 17:29:13 -08:00 committed by Prachi Damle
parent 9e13533e21
commit 05280976e5
1 changed files with 8 additions and 5 deletions

View File

@ -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();