diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2015-01-19 18:54:09 +0000 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2015-07-07 20:55:56 +0100 |
commit | cb3d265849771f7e53b0587196930328005414e0 (patch) | |
tree | 89cc665027b058443e6adc0881f1fe9df6f2d624 | |
parent | 5917dbd8f38bab29de9e40d1135b0e9e85cb91bc (diff) | |
download | sos-cb3d265849771f7e53b0587196930328005414e0.tar.gz |
[sosreport] add --sysroot option
Add a --sysroot=SYSROOT option to specify that the root file system to
be inspected is mounted at SYSROOT.
This allows basic support for container environments where sos is
running in a container and inspecting the containing host and its
environment ('superspection').
For this to work currently the following conditions must be met:
- sos is sufficiently privileged to read and search relevant file
system paths within SYSROOT
- sos must share the PID and network namespace of the target host
- binaries called by sos must be present and executable in the
SYSROOT inherited by sos. If PATH includes paths inside SYSROOT
appropriate values must be set for LD_LIBRARY_PATH to allow
shared executables to be linked.
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r-- | sos/sosreport.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/sos/sosreport.py b/sos/sosreport.py index 9a0cf6cc..47eddc97 100644 --- a/sos/sosreport.py +++ b/sos/sosreport.py @@ -529,6 +529,17 @@ class SoSOptions(object): self._report = value @property + def sysroot(self): + if self._options is not None: + return self._options.sysroot + return self._sysroot + + @sysroot.setter + def sysroot(self, value): + self._check_options_initialized() + self._sysroot = value + + @property def compression_type(self): if self._options is not None: return self._options.compression_type @@ -615,7 +626,10 @@ class SoSOptions(object): default=None) parser.add_option("--no-report", action="store_true", dest="report", - help="Disable HTML/XML reporting", default=True) + help="Disable HTML/XML reporting", default=False) + parser.add_option("-s", "--sysroot", action="store", dest="sysroot", + help="system root directory path (default='/')", + default="/") parser.add_option("-z", "--compression-type", dest="compression_type", help="compression technology to use [auto, " "gzip, bzip2, xz] (default=auto)", |