libcloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From je...@apache.org
Subject svn commit: r907889 - /incubator/libcloud/trunk/libcloud/drivers/ec2.py
Date Tue, 09 Feb 2010 02:36:49 GMT
Author: jerry
Date: Tue Feb  9 02:36:48 2010
New Revision: 907889

URL: http://svn.apache.org/viewvc?rev=907889&view=rev
Log:
Switching out explicit kwargs key checks instead of KeyError exceptions

Modified:
    incubator/libcloud/trunk/libcloud/drivers/ec2.py

Modified: incubator/libcloud/trunk/libcloud/drivers/ec2.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/drivers/ec2.py?rev=907889&r1=907888&r2=907889&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/drivers/ec2.py (original)
+++ incubator/libcloud/trunk/libcloud/drivers/ec2.py Tue Feb  9 02:36:48 2010
@@ -349,14 +349,14 @@
                   'MaxCount': kwargs.get('maxcount','1'),
                   'InstanceType': size.id}
 
-        try: params['SecurityGroup'] = kwargs['securitygroup']
-        except KeyError: pass
+        if 'securitygroup' in kwargs:
+            params['SecurityGroup'] = kwargs['securitygroup']
 
-        try: params['KeyName'] = kwargs['keyname']
-        except KeyError: pass
+        if 'keyname' in kwargs:
+            params['KeyName'] = kwargs['keyname']
 
-        try: params['UserData'] = base64.b64encode(kwargs['userdata'])
-        except KeyError: pass
+        if 'userdata' in kwargs:
+            params['UserData'] = base64.b64encode(kwargs['userdata'])
 
         object = self.connection.request('/', params=params).object
         nodes = self._to_nodes(object, 'instancesSet/item')



Mime
View raw message