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/01/15 02:31:24 UTC

svn commit: r899510 - /incubator/libcloud/trunk/libcloud/drivers/rimuhosting.py

Author: pquerna
Date: Fri Jan 15 01:31:23 2010
New Revision: 899510

URL: http://svn.apache.org/viewvc?rev=899510&view=rev
Log:
Correctly throw InvalidCredsException when you give rimuhosting a wrong API key

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

Modified: incubator/libcloud/trunk/libcloud/drivers/rimuhosting.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/drivers/rimuhosting.py?rev=899510&r1=899509&r2=899510&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/drivers/rimuhosting.py (original)
+++ incubator/libcloud/trunk/libcloud/drivers/rimuhosting.py Fri Jan 15 01:31:23 2010
@@ -16,7 +16,7 @@
 """
 RimuHosting Driver
 """
-from libcloud.types import Provider, NodeState
+from libcloud.types import Provider, NodeState, InvalidCredsException
 from libcloud.base import ConnectionKey, Response, NodeAuthPassword, NodeDriver, NodeSize, Node, NodeLocation
 from libcloud.base import NodeImage
 from copy import copy
@@ -46,8 +46,13 @@
         self.headers = dict(response.getheaders())
         self.error = response.reason
 
-        self.object = self.parse_body()
+        if self.success():
+          self.object = self.parse_body()
 
+    def success(self):
+        if self.status == 403:
+          raise InvalidCredsException()
+        return True
     def parse_body(self):
         try:
             js = json.loads(self.body)