From e10473db802125d261092a6d1d1474fcca10f509 Mon Sep 17 00:00:00 2001 From: Eric Desrochers Date: Tue, 19 Nov 2019 13:27:40 -0800 Subject: [PATCH] [Plugin] Detect copy operations without the adequate access rights (e.g. apparmor restriction for '/proc/sys/fs/binfmt' inside a LXD container) Fix: #1662 Resolves: #1867 Signed-off-by: Eric Desrochers Signed-off-by: Bryan Quigley --- sos/plugins/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py index 44ae413d0f..6c35ecdef6 100644 --- a/sos/plugins/__init__.py +++ b/sos/plugins/__init__.py @@ -744,6 +744,10 @@ def _copy_dir(self, srcpath): path = os.path.join(srcpath, name) self._do_copy_path(path) except OSError as e: + if e.errno == errno.EPERM or errno.EACCES: + msg = "Permission denied" + self._log_warn("_copy_dir: '%s' %s" % (srcpath, msg)) + return if e.errno == errno.ELOOP: msg = "Too many levels of symbolic links copying" self._log_error("_copy_dir: %s '%s'" % (msg, srcpath))