diff options
author | Thomas Waldmann <tw@waldmann-edv.de> | 2015-02-27 22:02:52 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2015-03-22 14:20:47 +0200 |
commit | aaa966f88ad7022f5c54f7a413e288a1b3004bbb (patch) | |
tree | 45b74bdc897416c7c54b6627310c9ac96ff4061f | |
parent | c8fa097da39ea2a8635f64c819c2129695edbf0c (diff) | |
download | obnam-aaa966f88ad7022f5c54f7a413e288a1b3004bbb.tar.gz |
sftp_plugin: use same mode for 2nd try after creating missing dirs
-rw-r--r-- | obnamlib/plugins/sftp_plugin.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/obnamlib/plugins/sftp_plugin.py b/obnamlib/plugins/sftp_plugin.py index f37c6904..59d83ecd 100644 --- a/obnamlib/plugins/sftp_plugin.py +++ b/obnamlib/plugins/sftp_plugin.py @@ -588,8 +588,9 @@ class SftpFS(obnamlib.VirtualFileSystem): @ioerror_to_oserror def write_file(self, pathname, contents): + mode = 'wbx' try: - f = self.open(pathname, 'wbx') + f = self.open(pathname, mode) except (IOError, OSError), e: # When the path to the file to be written does not # exist, we try to create the directories below. Note that @@ -601,7 +602,7 @@ class SftpFS(obnamlib.VirtualFileSystem): raise dirname = os.path.dirname(pathname) self.makedirs(dirname) - f = self.open(pathname, 'wx') + f = self.open(pathname, mode) self._write_helper(f, contents) f.close() |