Repository: libcloud
Updated Branches:
  refs/heads/trunk 68c73b5ca -> 0314a1a4c


Fix _ssh_client_connect method to correctly propagate an exception if a key file
doesn't exist instead of silently swallowing and ignoring it.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/0314a1a4
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/0314a1a4
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/0314a1a4

Branch: refs/heads/trunk
Commit: 0314a1a4c5f8d08b1084acbc561d31961e361ee1
Parents: 68c73b5
Author: Tomaz Muraus <[email protected]>
Authored: Wed Jul 2 19:59:16 2014 +0200
Committer: Tomaz Muraus <[email protected]>
Committed: Wed Jul 2 22:44:36 2014 +0200

----------------------------------------------------------------------
 CHANGES.rst              | 5 +++++
 libcloud/compute/base.py | 8 ++++++++
 2 files changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/0314a1a4/CHANGES.rst
----------------------------------------------------------------------
diff --git a/CHANGES.rst b/CHANGES.rst
index 0ffeb7c..ead8b26 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -42,6 +42,11 @@ Compute
   (GITHUB-331)
   [David Gay]
 
+- Propagate an exception in ``deploy_node`` method if user specified an invalid
+  path to the private key file. Previously this exception was silently 
swallowed
+  and ignored.
+  [Tomaz Muraus]
+
 DNS
 ~~~
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/0314a1a4/libcloud/compute/base.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/base.py b/libcloud/compute/base.py
index 99523ac..f9a9e31 100644
--- a/libcloud/compute/base.py
+++ b/libcloud/compute/base.py
@@ -1380,6 +1380,14 @@ class NodeDriver(BaseDriver):
             try:
                 ssh_client.connect()
             except SSH_TIMEOUT_EXCEPTION_CLASSES:
+                e = sys.exc_info()[1]
+                message = str(e).lower()
+                expected_msg = 'no such file or directory'
+
+                if isinstance(e, IOError) and expected_msg in message:
+                    # Propagate (key) file doesn't exist errors
+                    raise e
+
                 # Retry if a connection is refused, timeout occurred,
                 # or the connection fails due to failed authentication.
                 ssh_client.close()

Reply via email to