mirror of https://github.com/apache/cloudstack.git
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:
parent
9e13533e21
commit
05280976e5
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue