Blame SOURCES/sos-bz1148560-add-kpatch-plugin.patch

a1ee45
From bf1dd84ad4049246d79a63f3448b1e855d159a5d Mon Sep 17 00:00:00 2001
a1ee45
From: "Bryn M. Reeves" <bmr@redhat.com>
a1ee45
Date: Thu, 19 Jun 2014 10:49:17 +0100
a1ee45
Subject: [PATCH] [kpatch] new plugin
a1ee45
a1ee45
Based on a suggestion from Marc Milgram in rhbz#1110918.
a1ee45
a1ee45
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
a1ee45
---
a1ee45
 sos/plugins/kpatch.py | 38 ++++++++++++++++++++++++++++++++++++++
a1ee45
 1 file changed, 38 insertions(+)
a1ee45
 create mode 100644 sos/plugins/kpatch.py
a1ee45
a1ee45
diff --git a/sos/plugins/kpatch.py b/sos/plugins/kpatch.py
a1ee45
new file mode 100644
a1ee45
index 0000000..7909926
a1ee45
--- /dev/null
a1ee45
+++ b/sos/plugins/kpatch.py
a1ee45
@@ -0,0 +1,38 @@
a1ee45
+# Copyright (C) 2014 Red Hat, Inc. Bryn M. Reeves <bmr@redhat.com>
a1ee45
+# This program is free software; you can redistribute it and/or modify
a1ee45
+# it under the terms of the GNU General Public License as published by
a1ee45
+# the Free Software Foundation; either version 2 of the License, or
a1ee45
+# (at your option) any later version.
a1ee45
+
a1ee45
+# This program is distributed in the hope that it will be useful,
a1ee45
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
a1ee45
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
a1ee45
+# GNU General Public License for more details.
a1ee45
+
a1ee45
+# You should have received a copy of the GNU General Public License
a1ee45
+# along with this program; if not, write to the Free Software
a1ee45
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
a1ee45
+
a1ee45
+from sos.plugins import Plugin, RedHatPlugin
a1ee45
+import re
a1ee45
+
a1ee45
+
a1ee45
+class Kpatch(Plugin, RedHatPlugin):
a1ee45
+    """Kpatch information
a1ee45
+    """
a1ee45
+
a1ee45
+    plugin_name = 'kpatch'
a1ee45
+
a1ee45
+    packages = ('kpatch',)
a1ee45
+
a1ee45
+    def setup(self):
a1ee45
+        kpatch_list = self.get_cmd_output_now("kpatch list")
a1ee45
+        kpatches = open(kpatch_list, "r").read().splitlines()
a1ee45
+        for patch in kpatches:
a1ee45
+            if not re.match("^kpatch-.*\(.*\)", patch):
a1ee45
+                continue
a1ee45
+            (module, version) = patch.split()
a1ee45
+            self.add_cmd_output("kpatch info " + module)
a1ee45
+
a1ee45
+
a1ee45
+# vim: et ts=4 sw=4
a1ee45
-- 
a1ee45
1.9.3
a1ee45
a1ee45
From 6b43c42078604b0551923c2801108848e97ba3b9 Mon Sep 17 00:00:00 2001
a1ee45
From: "Bryn M. Reeves" <bmr@redhat.com>
a1ee45
Date: Tue, 14 Oct 2014 15:43:20 +0100
a1ee45
Subject: [PATCH] [kpatch] do not try to read kpatch data if it could not be
a1ee45
 run
a1ee45
a1ee45
Everything the kpatch plugin does requires the list of available
a1ee45
kpatch patches obtained from 'kpatch list'. If this fails return
a1ee45
immediately from the setup method.
a1ee45
a1ee45
Fixes #417.
a1ee45
a1ee45
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
a1ee45
---
a1ee45
 sos/plugins/kpatch.py | 2 ++
a1ee45
 1 file changed, 2 insertions(+)
a1ee45
a1ee45
diff --git a/sos/plugins/kpatch.py b/sos/plugins/kpatch.py
a1ee45
index 7909926..6ef557e 100644
a1ee45
--- a/sos/plugins/kpatch.py
a1ee45
+++ b/sos/plugins/kpatch.py
a1ee45
@@ -27,6 +27,8 @@ class Kpatch(Plugin, RedHatPlugin):
a1ee45
 
a1ee45
     def setup(self):
a1ee45
         kpatch_list = self.get_cmd_output_now("kpatch list")
a1ee45
+        if not kpatch_list:
a1ee45
+            return
a1ee45
         kpatches = open(kpatch_list, "r").read().splitlines()
a1ee45
         for patch in kpatches:
a1ee45
             if not re.match("^kpatch-.*\(.*\)", patch):
a1ee45
-- 
a1ee45
1.9.3
a1ee45