Blob Blame History Raw
From d381fc6d15b8bc39a76aafdf853f73d887745473 Mon Sep 17 00:00:00 2001
From: "Bryn M. Reeves" <bmr@redhat.com>
Date: Fri, 23 Jan 2015 15:24:00 +0000
Subject: [PATCH 52/93] [plugins] propagate sysroot to Plugin via commons

Although plugins should generally be unaware that they are being
run with an alternate sysroot the generic plugin IO code must
peform the appropriate path prefixing when sysroot is not '/'.

Propagate sysroot to plugin classes via the commons dictionary.

Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
---
 sos/sosreport.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sos/sosreport.py b/sos/sosreport.py
index edc9cba..21c12ad 100644
--- a/sos/sosreport.py
+++ b/sos/sosreport.py
@@ -632,6 +632,7 @@ class SoSReport(object):
         self.archive = None
         self.tempfile_util = None
         self._args = args
+        self.sysroot = "/"
 
         try:
             import signal
@@ -661,6 +662,10 @@ class SoSReport(object):
         self.tempfile_util = TempFileUtil(self.tmpdir)
         self._set_directories()
 
+        # set alternate system root directory
+        if self.opts.sysroot:
+            self.sysroot = self.opts.sysroot
+
     def print_header(self):
         self.ui_log.info("\n%s\n" % _("sosreport (version %s)" %
                          (__version__,)))
@@ -673,6 +678,7 @@ class SoSReport(object):
             'tmpdir': self.tmpdir,
             'soslog': self.soslog,
             'policy': self.policy,
+            'sysroot': self.sysroot,
             'verbosity': self.opts.verbosity,
             'xmlreport': self.xml_report,
             'cmdlineopts': self.opts,
-- 
1.9.3