Blob Blame History Raw
From 05939f9b27de1b057573495d737f88eef4797011 Mon Sep 17 00:00:00 2001
From: "Bryn M. Reeves" <bmr@redhat.com>
Date: Sun, 25 Jan 2015 23:27:51 +0000
Subject: [PATCH 65/93] [plugin] enforce forbidden paths when --sysroot is set

Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
---
 sos/plugins/__init__.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
index 5df40ff..394973d 100644
--- a/sos/plugins/__init__.py
+++ b/sos/plugins/__init__.py
@@ -311,6 +311,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):
@@ -373,13 +375,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"""
-- 
1.9.3