You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2012/02/20 03:01:29 UTC

svn commit: r1291117 - in /libcloud/trunk: CHANGES libcloud/compute/base.py

Author: tomaz
Date: Mon Feb 20 02:01:28 2012
New Revision: 1291117

URL: http://svn.apache.org/viewvc?rev=1291117&view=rev
Log:
1. Allow user to pass 'max_tries' keyword argument to deploy_node method.
2. Include original exception error message when re-throwing an exception
inside _run_deployment_script method.

Modified:
    libcloud/trunk/CHANGES
    libcloud/trunk/libcloud/compute/base.py

Modified: libcloud/trunk/CHANGES
URL: http://svn.apache.org/viewvc/libcloud/trunk/CHANGES?rev=1291117&r1=1291116&r2=1291117&view=diff
==============================================================================
--- libcloud/trunk/CHANGES (original)
+++ libcloud/trunk/CHANGES Mon Feb 20 02:01:28 2012
@@ -31,6 +31,13 @@ Changes with Apache Libcloud in developm
       multiple times ; LIBCLOUD-153
       [Dave King]
 
+    - Allow user to pass 'max_tries' keyword argument to deploy_node method.
+      [Tomaz Muraus]
+
+    - Include original exception error message when re-throwing an exception
+      inside _run_deployment_script method.
+      [Tomaz Muraus]
+
   *) Storage:
 
     - Don't lowercase special header names in the Amazon S3 storage driver. ;
@@ -45,7 +52,7 @@ Changes with Apache Libcloud in developm
 
     - Add an extension method (ex_balancer_attach_members) for attaching 
       multiple members to a load balancer in the Rackspace driver.
-      LIBCLOUD-152  
+      LIBCLOUD-152
       [Adam Pickeral]
 
 Changes with Apache Libcloud 0.8.0:

Modified: libcloud/trunk/libcloud/compute/base.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/compute/base.py?rev=1291117&r1=1291116&r2=1291117&view=diff
==============================================================================
--- libcloud/trunk/libcloud/compute/base.py (original)
+++ libcloud/trunk/libcloud/compute/base.py Mon Feb 20 02:01:28 2012
@@ -524,6 +524,10 @@ class NodeDriver(BaseDriver):
                              to attempt to authenticate. (optional)
         @type       ssh_key: C{string} or C{list} of C{string}s
 
+        @keyword    max_tries: How many times to retry if a deployment fails
+                               before giving up (default is 3)
+        @type       max_tries: C{int}
+
         See L{NodeDriver.create_node} for more keyword args.
 
         >>> from libcloud.compute.drivers.dummy import DummyNodeDriver
@@ -567,6 +571,7 @@ class NodeDriver(BaseDriver):
                 password = kwargs['auth'].password
 
         node = self.create_node(**kwargs)
+        max_tries = kwargs.get('max_tries', 3)
 
         if 'generates_password' in self.features['create_node']:
             password = node.extra.get('password')
@@ -595,7 +600,7 @@ class NodeDriver(BaseDriver):
             self._run_deployment_script(task=kwargs['deploy'],
                                         node=node,
                                         ssh_client=ssh_client,
-                                        max_tries=3)
+                                        max_tries=max_tries)
         except Exception:
             e = sys.exc_info()[1]
             raise DeploymentError(node, e)
@@ -704,8 +709,9 @@ class NodeDriver(BaseDriver):
             except Exception:
                 tries += 1
                 if tries >= max_tries:
-                    raise LibcloudError(value='Failed after %d tries'
-                                        % (max_tries), driver=self)
+                    e = sys.exc_info()[1]
+                    raise LibcloudError(value='Failed after %d tries: %s'
+                                        % (max_tries, str(e)), driver=self)
             else:
                 ssh_client.close()
                 return node