aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2014-06-06 19:45:18 +0100
committerBryn M. Reeves <bmr@redhat.com>2014-06-06 19:45:18 +0100
commitcab2c71349361166a16408befac6b2b3b743c50a (patch)
treeb3d61230d47a6220e1e9d93a726b3b0745569d61
parentfd68a0ca2e65e22bcfcfe886676693e7a339e1e1 (diff)
downloadsos-cab2c71349361166a16408befac6b2b3b743c50a.tar.gz
[archive] Use OSError instead of PermissionError
The PermissionError exception is a python3 feature. Instead catch the OSError (from which it inherits) to work on both py2 and py3 runtimes. Related: #164 Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--sos/archive.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/sos/archive.py b/sos/archive.py
index 9df3782a..caf621e7 100644
--- a/sos/archive.py
+++ b/sos/archive.py
@@ -144,7 +144,7 @@ class FileCacheArchive(Archive):
self.log_debug("caught '%s' copying '%s'" % (e, src))
try:
shutil.copystat(src, dest)
- except PermissionError:
+ except OSError:
# SELinux xattrs in /proc and /sys throw this
pass
try:
@@ -164,7 +164,7 @@ class FileCacheArchive(Archive):
if os.path.exists(src):
try:
shutil.copystat(src, dest)
- except PermissionError:
+ except OSError:
pass
self.log_debug("added string at '%s' to FileCacheArchive '%s'"
% (src, self._archive_root))
@@ -260,7 +260,7 @@ class TarFileArchive(FileCacheArchive):
def _build_archive(self):
tar = tarfile.open(self._archive_name, mode="w")
- # We need to pass the absolute path to the archive root but we
+ # we need to pass the absolute path to the archive root but we
# want the names used in the archive to be relative.
tar.add(self._archive_root, arcname=os.path.split(self._name)[1],
filter=self.copy_permissions_filter)