diff options
author | Lars Wirzenius <liw@liw.fi> | 2013-08-15 19:01:10 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2013-08-15 19:01:10 +0100 |
commit | ddf67bb69784c3084cb0e38ad988f402ce012cfe (patch) | |
tree | 71330c8d2bf4bf291f8ed372fd6de9a26227f7c6 | |
parent | 486c86999b8fda82bbc432bcfffd1bd098995b40 (diff) | |
download | obnam-ddf67bb69784c3084cb0e38ad988f402ce012cfe.tar.gz |
SFTP write_file handles EACCESS as ENOENT
Patch by Armin Größlinger.
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | obnamlib/plugins/sftp_plugin.py | 8 |
2 files changed, 11 insertions, 1 deletions
@@ -26,6 +26,10 @@ Bug fixes: extra files, such as "lock" (left there by a previous, crashed Obnam run). It no longer does. Fix by Lars Kruse. +* The SFTP plugin now handles another error code (EACCESS) when writing + a file and the directory it should go into not existing. Patch by + Armin Größlinger. + Version 1.5, released 2013-08-08 -------------------------------- diff --git a/obnamlib/plugins/sftp_plugin.py b/obnamlib/plugins/sftp_plugin.py index a4d12fa9..8b78f55c 100644 --- a/obnamlib/plugins/sftp_plugin.py +++ b/obnamlib/plugins/sftp_plugin.py @@ -529,7 +529,13 @@ class SftpFS(obnamlib.VirtualFileSystem): try: f = self.open(pathname, 'wx') except (IOError, OSError), e: - if e.errno != errno.ENOENT: + # When the path to the file to be written does not + # exist, we try to create the directories below. Note that + # some SFTP servers return EACCES instead of ENOENT + # when the path to the file does not exist, so we + # do not raise an exception here for both ENOENT + # and EACCES. + if e.errno != errno.ENOENT and e.errno != errno.EACCES: raise dirname = os.path.dirname(pathname) self.makedirs(dirname) |