Blob Blame History Raw
From cc4aad6e9574fcc236b485a25618c87c5b95a28e Mon Sep 17 00:00:00 2001
From: "Bryn M. Reeves" <bmr@redhat.com>
Date: Sun, 25 Jan 2015 15:04:29 +0000
Subject: [PATCH 58/93] [plugins] implement --chroot for command callouts

When --chroot=always is given chroot all commands to SYSROOT.

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

diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
index 3f8f628..9fa2802 100644
--- a/sos/plugins/__init__.py
+++ b/sos/plugins/__init__.py
@@ -493,7 +493,12 @@ class Plugin(object):
             self._log_info("added copyspec '%s'" % copy_paths)
 
     def get_command_output(self, prog, timeout=300, runat=None):
-        result = sos_get_command_output(prog, timeout=timeout, chdir=runat)
+        if self.commons['cmdlineopts'].chroot == 'always':
+            root = self.sysroot
+        else:
+            root = None
+        result = sos_get_command_output(prog, timeout=timeout,
+                                        chroot=root, chdir=runat)
         if result['status'] == 124:
             self._log_warn("command '%s' timed out after %ds"
                            % (prog, timeout))
-- 
1.9.3