aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2015-01-25 23:27:51 +0000
committerBryn M. Reeves <bmr@redhat.com>2015-07-08 17:05:21 +0100
commit5ae1b392d1f081bcb43e91a572342d6f02e4728d (patch)
tree5bf5c6e3a2cfca72df2bb6aa595b2ffdcd472ffa
parent3390d070b2945715a15f74462c511df2b2941ef5 (diff)
downloadsos-5ae1b392d1f081bcb43e91a572342d6f02e4728d.tar.gz
[plugin] enforce forbidden paths when --sysroot is set
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--sos/plugins/__init__.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
index 49f62bfa..fd1acb5f 100644
--- a/sos/plugins/__init__.py
+++ b/sos/plugins/__init__.py
@@ -317,6 +317,8 @@ class Plugin(object):
return None
def _is_forbidden_path(self, path):
+ if self.use_sysroot():
+ path = self.join_sysroot(path)
return _path_in_path_list(path, self.forbidden_paths)
def _copy_node(self, path, st):
@@ -379,13 +381,15 @@ class Plugin(object):
'symlink': "no"
})
- def add_forbidden_path(self, forbiddenPath):
+ def add_forbidden_path(self, forbidden):
"""Specify a path to not copy, even if it's part of a copy_specs[]
entry.
"""
+ if self.use_sysroot():
+ forbidden = self.join_sysroot(forbidden)
# Glob case handling is such that a valid non-glob is a reduced glob
- for filespec in glob.glob(forbiddenPath):
- self.forbidden_paths.append(filespec)
+ for path in glob.glob(forbidden):
+ self.forbidden_paths.append(path)
def get_all_options(self):
"""return a list of all options selected"""