libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject [1/4] libcloud git commit: Fix caching of Google auth tokens
Date Sat, 30 Jul 2016 11:16:40 GMT
Repository: libcloud
Updated Branches:
  refs/heads/trunk dcb4cd998 -> 25c414e33


Fix caching of Google auth tokens

_write_token_to_file was not zeroing the file before writing
a new token, causing corruption.

FIXES: LIBCLOUD-835

Closes #844

Signed-off-by: Tomaz Muraus <tomaz@tomaz.me>


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

Branch: refs/heads/trunk
Commit: 78df34cf8db8706440ee594c571d80de8613433e
Parents: dcb4cd9
Author: Paul Tiplady <paul@qwil.co>
Authored: Fri Jul 22 11:32:27 2016 -0700
Committer: Tomaz Muraus <tomaz@tomaz.me>
Committed: Sat Jul 30 12:56:00 2016 +0200

----------------------------------------------------------------------
 libcloud/common/google.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/78df34cf/libcloud/common/google.py
----------------------------------------------------------------------
diff --git a/libcloud/common/google.py b/libcloud/common/google.py
index 2912817..68aa77c 100644
--- a/libcloud/common/google.py
+++ b/libcloud/common/google.py
@@ -688,7 +688,7 @@ class GoogleOAuth2Credential(object):
         """
         filename = os.path.realpath(os.path.expanduser(self.credential_file))
         data = json.dumps(self.token)
-        with os.fdopen(os.open(filename, os.O_CREAT | os.O_WRONLY,
+        with os.fdopen(os.open(filename, os.O_CREAT | os.O_WRONLY | os.O_TRUNC,
                                int('600', 8)), 'w') as f:
             f.write(data)
 


Mime
View raw message