Repository: libcloud Updated Branches: refs/heads/trunk 68a3461a6 -> 95ae5beea
[LIBCLOUD-610] gce: better error message for missing key file Closes #424 Signed-off-by: Eric Johnson <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/95ae5bee Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/95ae5bee Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/95ae5bee Branch: refs/heads/trunk Commit: 95ae5beea125797ba3bd07028af1dbbd65dc2265 Parents: 68a3461 Author: Eric Johnson <[email protected]> Authored: Tue Dec 30 21:10:41 2014 +0000 Committer: Eric Johnson <[email protected]> Committed: Tue Dec 30 21:24:50 2014 +0000 ---------------------------------------------------------------------- CHANGES.rst | 4 ++++ libcloud/common/google.py | 3 +++ 2 files changed, 7 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/95ae5bee/CHANGES.rst ---------------------------------------------------------------------- diff --git a/CHANGES.rst b/CHANGES.rst index 47a1ab6..215b0d4 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -16,6 +16,10 @@ General Compute ~~~~~~~ +- GCE improved error checking / message if missing API PEM file. + (LIBCLOUD-610, GITHUB-424) + [Eric Johnson] + - GCE Licenses added to the GCE driver. (GITHUB-420) [Eric Johnson] http://git-wip-us.apache.org/repos/asf/libcloud/blob/95ae5bee/libcloud/common/google.py ---------------------------------------------------------------------- diff --git a/libcloud/common/google.py b/libcloud/common/google.py index ebb9fdf..5069016 100644 --- a/libcloud/common/google.py +++ b/libcloud/common/google.py @@ -488,6 +488,9 @@ class GoogleServiceAcctAuthConnection(GoogleBaseAuthConnection): # The message contains both the header and claim set message = '%s.%s' % (header_enc, claim_set_enc) # Then the message is signed using the key supplied + if not os.access(self.key, os.F_OK | os.R_OK): + raise ValueError("Missing (or not readable) key " + "file: '%s'" % (self.key)) key = RSA.importKey(self.key) hash_func = SHA256.new(message) signer = PKCS1_v1_5.new(key)
