You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by pq...@apache.org on 2010/04/22 21:07:32 UTC

svn commit: r937014 - /incubator/libcloud/trunk/libcloud/drivers/ec2.py

Author: pquerna
Date: Thu Apr 22 19:07:32 2010
New Revision: 937014

URL: http://svn.apache.org/viewvc?rev=937014&view=rev
Log:
Handle invalid user/passwords from Eucalyptus, which don't return XML like amazon does.

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=937014&r1=937013&r2=937014&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/drivers/ec2.py (original)
+++ incubator/libcloud/trunk/libcloud/drivers/ec2.py Thu Apr 22 19:07:32 2010
@@ -128,6 +128,12 @@ class EC2Response(Response):
 
     def parse_error(self):
         err_list = []
+        # Okay, so for Eucalyptus, you can get a 403, with no body,
+        # if you are using the wrong user/password.
+        msg = "Failure: 403 Forbidden"
+        if self.status == 403 and self.body[:len(msg)] == msg:
+          raise InvalidCredsException(msg)
+
         for err in ET.XML(self.body).findall('Errors/Error'):
             code, message = err.getchildren()
             err_list.append("%s: %s" % (code.text, message.text))