Blob Blame History Raw
From 943b3c3cd096f8efaeb4f0f2008391abe4c9f7e2 Mon Sep 17 00:00:00 2001
From: Pavel Moravec <pmoravec@redhat.com>
Date: Sat, 2 May 2020 17:22:35 +0200
Subject: [PATCH] [containers_common] Add plugin for common containers configs

Move collection of whole /etc/containers and /usr/share/containers to
one containers_common plugin enabled by the package of the same name.

Since the package is a common dependency for buildah and podman, no regression
in default data collection happens.

Resolves: #2040

Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
---
 sos/plugins/buildah.py           |  7 -------
 sos/plugins/containers_common.py | 27 +++++++++++++++++++++++++
 sos/plugins/podman.py            |  7 -------
 3 files changed, 27 insertions(+), 14 deletions(-)
 create mode 100644 sos/plugins/containers_common.py

diff --git a/sos/plugins/buildah.py b/sos/plugins/buildah.py
index 9d237a53..4b8b3b0a 100644
--- a/sos/plugins/buildah.py
+++ b/sos/plugins/buildah.py
@@ -20,13 +20,6 @@ class Buildah(Plugin, RedHatPlugin):
     profiles = ('container',)
 
     def setup(self):
-        self.add_copy_spec([
-            "/etc/containers/registries.conf",
-            "/etc/containers/storage.conf",
-            "/etc/containers/mounts.conf",
-            "/etc/containers/policy.json",
-        ])
-
         subcmds = [
             'containers',
             'containers --all',
diff --git a/sos/plugins/containers_common.py b/sos/plugins/containers_common.py
new file mode 100644
index 00000000..99ae88fe
--- /dev/null
+++ b/sos/plugins/containers_common.py
@@ -0,0 +1,29 @@
+# Copyright (C) 2020 Red Hat, Inc., Pavel Moravec <pmoravec@redhat.com>
+
+# This file is part of the sos project: https://github.com/sosreport/sos
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions of
+# version 2 of the GNU General Public License.
+#
+# See the LICENSE file in the source distribution for further information.
+
+from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin
+
+
+class ContainersCommon(Plugin, RedHatPlugin, UbuntuPlugin):
+    '''Common container configs
+    '''
+
+    short_desc = 'Common container configs under {/etc,/usr/share}/containers'
+    plugin_name = 'containers_common'
+    profiles = ('container', )
+    packages = ('containers-common', )
+
+    def setup(self):
+        self.add_copy_spec([
+            '/etc/containers/*',
+            '/usr/share/containers/*',
+        ])
+
+# vim: set et ts=4 sw=4 :
diff --git a/sos/plugins/podman.py b/sos/plugins/podman.py
index f6875197..f6632776 100644
--- a/sos/plugins/podman.py
+++ b/sos/plugins/podman.py
@@ -27,13 +27,6 @@ class Podman(Plugin, RedHatPlugin, UbuntuPlugin):
     ]
 
     def setup(self):
-        self.add_copy_spec([
-            "/etc/containers/registries.conf",
-            "/etc/containers/storage.conf",
-            "/etc/containers/mounts.conf",
-            "/etc/containers/policy.json",
-        ])
-
         self.add_env_var([
             'HTTP_PROXY',
             'HTTPS_PROXY',
-- 
2.21.3