Blame SOURCES/sos-bz1679238-crio-plugin.patch

03853b
From 64d7cccf48aee9a07e2e4c5237034638cae30391 Mon Sep 17 00:00:00 2001
03853b
From: Daniel J Walsh <dwalsh@redhat.com>
03853b
Date: Wed, 29 Aug 2018 06:51:21 -0400
03853b
Subject: [PATCH] [crio] Add support for gathering information on cri-o
03853b
 containers
03853b
03853b
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
03853b
---
03853b
 sos/plugins/crio.py | 74 +++++++++++++++++++++++++++++++++++++++++++++
03853b
 1 file changed, 74 insertions(+)
03853b
 create mode 100644 sos/plugins/crio.py
03853b
03853b
diff --git a/sos/plugins/crio.py b/sos/plugins/crio.py
03853b
new file mode 100644
03853b
index 00000000..f3e9d842
03853b
--- /dev/null
03853b
+++ b/sos/plugins/crio.py
03853b
@@ -0,0 +1,74 @@
03853b
+# Copyright (C) 2018 Red Hat, Inc. Daniel Walsh <dwalsh@redhat.com>
03853b
+
03853b
+# This file is part of the sos project: https://github.com/sosreport/sos
03853b
+#
03853b
+# This copyrighted material is made available to anyone wishing to use,
03853b
+# modify, copy, or redistribute it subject to the terms and conditions of
03853b
+# version 2 of the GNU General Public License.
03853b
+#
03853b
+# See the LICENSE file in the source distribution for further information.
03853b
+
03853b
+from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin
03853b
+
03853b
+
03853b
+class CRIO(Plugin):
03853b
+
03853b
+    """CRI-O containers
03853b
+    """
03853b
+
03853b
+    plugin_name = 'crio'
03853b
+    profiles = ('container',)
03853b
+    packages = ('cri-o', "cri-tools")
03853b
+
03853b
+    option_list = [
03853b
+        ("all", "enable capture for all containers, even containers "
03853b
+            "that have terminated", 'fast', False),
03853b
+        ("logs", "capture logs for running containers",
03853b
+            'fast', False),
03853b
+    ]
03853b
+
03853b
+    def setup(self):
03853b
+        self.add_copy_spec([
03853b
+            "/etc/containers/registries.conf",
03853b
+            "/etc/containers/storage.conf",
03853b
+            "/etc/containers/mounts.conf",
03853b
+            "/etc/containers/policy.json",
03853b
+            "/etc/crio/crio.conf",
03853b
+            "/etc/crio/seccomp.json",
03853b
+            "/etc/systemd/system/cri-o.service",
03853b
+        ])
03853b
+
03853b
+        subcmds = [
03853b
+            'info',
03853b
+            'images',
03853b
+            'pods',
03853b
+            'ps',
03853b
+            'ps -a',
03853b
+            'stats',
03853b
+            'version',
03853b
+        ]
03853b
+
03853b
+        self.add_cmd_output(["crictl %s" % s for s in subcmds])
03853b
+        self.add_journal(units="cri-o")
03853b
+        self.add_cmd_output("ls -alhR /etc/cni")
03853b
+
03853b
+        ps_cmd = 'crictl ps --quiet'
03853b
+        if self.get_option('all'):
03853b
+            ps_cmd = "%s -a" % ps_cmd
03853b
+
03853b
+        img_cmd = 'cri-o images --quiet'
03853b
+        insp = set()
03853b
+
03853b
+        for icmd in [ps_cmd, img_cmd]:
03853b
+            result = self.get_command_output(icmd)
03853b
+            if result['status'] == 0:
03853b
+                for con in result['output'].splitlines():
03853b
+                    insp.add(con)
03853b
+
03853b
+        if insp:
03853b
+            for container in insp:
03853b
+                self.add_cmd_output("crictl inspect %s" % container)
03853b
+                if self.get_option('logs'):
03853b
+                    self.add_cmd_output("crictl logs -t %s" % container)
03853b
+
03853b
+# vim: set et ts=4 sw=4 :
03853b
-- 
03853b
2.17.2
03853b
03853b
From 36a82723dfc2734b18eede4b75708595345c9d7a Mon Sep 17 00:00:00 2001
03853b
From: Jake Hunsaker <jhunsake@redhat.com>
03853b
Date: Mon, 25 Feb 2019 11:50:50 -0500
03853b
Subject: [PATCH] [crio] Add tagging classes
03853b
03853b
Adds tagging classes so plugin will run on Red Hat and Ubuntu based
03853b
systems.
03853b
03853b
Resolves: #1578
03853b
03853b
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
03853b
---
03853b
 sos/plugins/crio.py | 2 +-
03853b
 1 file changed, 1 insertion(+), 1 deletion(-)
03853b
03853b
diff --git a/sos/plugins/crio.py b/sos/plugins/crio.py
03853b
index f3e9d842..7afdf047 100644
03853b
--- a/sos/plugins/crio.py
03853b
+++ b/sos/plugins/crio.py
03853b
@@ -11,7 +11,7 @@
03853b
 from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin
03853b
 
03853b
 
03853b
-class CRIO(Plugin):
03853b
+class CRIO(Plugin, RedHatPlugin, UbuntuPlugin):
03853b
 
03853b
     """CRI-O containers
03853b
     """
03853b
-- 
03853b
2.17.2
03853b