From 4fc8b401992402f9cb45e68db883c90875107572 Mon Sep 17 00:00:00 2001 From: "Bryn M. Reeves" Date: Thu, 11 Sep 2014 12:52:16 +0100 Subject: [PATCH] [plugin] backport add_cmd_outputs commit 40646007c03f9088f0d6136b50a83077b1b8934c Author: Bryn M. Reeves Date: Sun Apr 6 20:13:59 2014 +0100 Add add_cmd_outputs() and convert plugins to use it Add a new method to Plugin to add a list of commands to be run, analogous to add_copy_specs() vs add_copy_spec(). Also convert a few plugins not using add_copy_specs() for long file lists (or using it inconsistently). Signed-off-by: Bryn M. Reeves Signed-off-by: Bryn M. Reeves --- sos/plugins/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py index 2bf8d98..f50df79 100644 --- a/sos/plugins/__init__.py +++ b/sos/plugins/__init__.py @@ -504,6 +504,12 @@ class Plugin(object): (status, output, runtime) = self.call_ext_prog(prog) return (status == 0) + def add_cmd_outputs(self, cmds, timeout=300): + """Run a list of programs and collect the output""" + if isinstance(cmds, basestring): + raise TypeError("Plugin.add_cmd_outputs called with string argument") + for cmd in cmds: + self.add_cmd_output(cmd, timeout=timeout) def add_cmd_output(self, exe, suggest_filename=None, root_symlink=None, timeout=300): """Run a program and collect the output""" -- 1.9.3