Blame SOURCES/0051-sosreport-add-sysroot-option.patch

0cd6dc
From 5c5fde328585732923f3f0a8e966c4daaec3c7ed Mon Sep 17 00:00:00 2001
0cd6dc
From: "Bryn M. Reeves" <bmr@redhat.com>
0cd6dc
Date: Mon, 19 Jan 2015 18:54:09 +0000
0cd6dc
Subject: [PATCH 51/93] [sosreport] add --sysroot option
0cd6dc
0cd6dc
Add a --sysroot=SYSROOT option to specify that the root file system to
0cd6dc
be inspected is mounted at SYSROOT.
0cd6dc
0cd6dc
This allows basic support for container environments where sos is
0cd6dc
running in a container and inspecting the containing host and its
0cd6dc
environment ('superspection').
0cd6dc
0cd6dc
For this to work currently the following conditions must be met:
0cd6dc
0cd6dc
- sos is sufficiently privileged to read and search relevant file
0cd6dc
  system paths within SYSROOT
0cd6dc
0cd6dc
- sos must share the PID and network namespace of the target host
0cd6dc
0cd6dc
- binaries called by sos must be present and executable in the
0cd6dc
  SYSROOT inherited by sos. If PATH includes paths inside SYSROOT
0cd6dc
  appropriate values must be set for LD_LIBRARY_PATH to allow
0cd6dc
  shared executables to be linked.
0cd6dc
0cd6dc
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
0cd6dc
---
0cd6dc
 sos/sosreport.py | 14 ++++++++++++++
0cd6dc
 1 file changed, 14 insertions(+)
0cd6dc
0cd6dc
diff --git a/sos/sosreport.py b/sos/sosreport.py
0cd6dc
index e83e718..edc9cba 100644
0cd6dc
--- a/sos/sosreport.py
0cd6dc
+++ b/sos/sosreport.py
0cd6dc
@@ -514,6 +514,17 @@ class SoSOptions(object):
0cd6dc
         self._report = value
0cd6dc
 
0cd6dc
     @property
0cd6dc
+    def sysroot(self):
0cd6dc
+        if self._options is not None:
0cd6dc
+            return self._options.sysroot
0cd6dc
+        return self._sysroot
0cd6dc
+
0cd6dc
+    @sysroot.setter
0cd6dc
+    def sysroot(self, value):
0cd6dc
+        self._check_options_initialized()
0cd6dc
+        self._sysroot = value
0cd6dc
+
0cd6dc
+    @property
0cd6dc
     def compression_type(self):
0cd6dc
         if self._options is not None:
0cd6dc
             return self._options.compression_type
0cd6dc
@@ -598,6 +609,9 @@ class SoSOptions(object):
0cd6dc
         parser.add_option("--no-report", action="store_true",
0cd6dc
                           dest="report",
0cd6dc
                           help="Disable HTML/XML reporting", default=False)
0cd6dc
+        parser.add_option("-s", "--sysroot", action="store", dest="sysroot",
0cd6dc
+                          help="system root directory path (default='/')",
0cd6dc
+                          default="/")
0cd6dc
         parser.add_option("-z", "--compression-type", dest="compression_type",
0cd6dc
                           help="compression technology to use [auto, "
0cd6dc
                                "gzip, bzip2, xz] (default=auto)",
0cd6dc
-- 
0cd6dc
1.9.3
0cd6dc