The issue here is that boto does not do input validation in some cases and in case the keypair is empty, it should not send a malformed request to the service. Something like,
- def get_key_pair(self, keyname):
+ def get_key_pair(self, keyname=None):
""" Convenience method to retrieve a specific keypair (KeyPair).
@@ -607,10 +607,11 @@
@rtype: L{KeyPair<boto.ec2.keypair.KeyPair>}
@return: The KeyPair specified or None if it is not found
"""
- try:
- return self.get_all_key_pairs(keynames=[keyname])[0]
- except IndexError: # None of those key pairs available
- return None
+ if keyname:
+ try:
+ return self.get_all_key_pairs(keynames=[keyname])[0]
+ except IndexError: # None of those key pairs available
+ return None
def create_key_pair(self, key_name):
"""
However, Eucalyptus should not throw an "500 Internal Error" regardless, so this issue needs to be fixed on both ends.
The issue here is that boto does not do input validation in some cases and in case the keypair is empty, it should not send a malformed request to the service. Something like,
--- boto-1. 8d-orig/ boto/ec2/ connection. py 2009-06-24 18:28:54.000000000 -0700 8d/boto/ ec2/connection. py 2010-03-02 13:50:51.000000000 -0800
self. build_list_ params( params, keynames, 'KeyName') list('DescribeK eyPairs' , params, [('item', KeyPair)])
+++ boto-1.
@@ -597,7 +597,7 @@
return self.get_
- def get_key_pair(self, keyname):
Convenience method to retrieve a specific keypair (KeyPair).
+ def get_key_pair(self, keyname=None):
"""
@@ -607,10 +607,11 @@ boto.ec2. keypair. KeyPair> } all_key_ pairs(keynames= [keyname] )[0] all_key_ pairs(keynames= [keyname] )[0]
@rtype: L{KeyPair<
@return: The KeyPair specified or None if it is not found
"""
- try:
- return self.get_
- except IndexError: # None of those key pairs available
- return None
+ if keyname:
+ try:
+ return self.get_
+ except IndexError: # None of those key pairs available
+ return None
def create_ key_pair( self, key_name):
"""
However, Eucalyptus should not throw an "500 Internal Error" regardless, so this issue needs to be fixed on both ends.