Blame SOURCES/sos-bz1148784-plugin-backport-add_cmd_outputs.patch

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