Blame SOURCES/sos-bz1844853-nfs-etc-exports.patch

bceef4
From fad72dbacc7e5c3c2721e452823750974ea31550 Mon Sep 17 00:00:00 2001
bceef4
From: Pavel Moravec <pmoravec@redhat.com>
bceef4
Date: Mon, 18 May 2020 11:41:17 +0200
bceef4
Subject: [PATCH] [nfs] merge nfsserver plugin into nfs one
bceef4
bceef4
nfsserver plugin enabledness relies on legacy init scripts. A more
bceef4
appropriate way to idenfity a NFS server is via nfs-utils package
bceef4
(though it could be present also on a NFS client).
bceef4
bceef4
As that package enables nfs plugin, it is reasonable to merge the
bceef4
plugins into one.
bceef4
bceef4
Closes: #2061
bceef4
Resolves: #2073
bceef4
bceef4
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
bceef4
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
bceef4
---
bceef4
 sos/plugins/nfs.py       | 14 +++++++--
bceef4
 sos/plugins/nfsserver.py | 54 ---------------------------------
bceef4
 2 files changed, 12 insertions(+), 56 deletions(-)
bceef4
 delete mode 100644 sos/plugins/nfsserver.py
bceef4
bceef4
diff --git a/sos/plugins/nfs.py b/sos/plugins/nfs.py
bceef4
index bebe0362..1c0d8fc8 100644
bceef4
--- a/sos/plugins/nfs.py
bceef4
+++ b/sos/plugins/nfs.py
bceef4
@@ -14,7 +14,7 @@ class Nfs(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
bceef4
     """
bceef4
     plugin_name = 'nfs'
bceef4
     profiles = ('storage', 'network', 'nfs')
bceef4
-    packages = ['nfs-utils']
bceef4
+    packages = ('nfs-utils', )
bceef4
 
bceef4
     def setup(self):
bceef4
         self.add_copy_spec([
bceef4
@@ -24,8 +24,18 @@ class Nfs(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
bceef4
             "/proc/fs/nfsfs/servers",
bceef4
             "/proc/fs/nfsfs/volumes",
bceef4
             "/run/sysconfig/nfs-utils",
bceef4
+            "/etc/exports",
bceef4
+            "/etc/exports.d",
bceef4
+            "/var/lib/nfs/etab",
bceef4
+            "/var/lib/nfs/xtab",
bceef4
+            "/var/lib/nfs/rmtab",
bceef4
+        ])
bceef4
+
bceef4
+        self.add_cmd_output([
bceef4
+            "rpcinfo -p localhost",
bceef4
+            "nfsstat -o all",
bceef4
+            "exportfs -v",
bceef4
         ])
bceef4
-        return
bceef4
 
bceef4
 
bceef4
 # vim: set et ts=4 sw=4 :
bceef4
diff --git a/sos/plugins/nfsserver.py b/sos/plugins/nfsserver.py
bceef4
deleted file mode 100644
bceef4
index 558ebd5d..00000000
bceef4
--- a/sos/plugins/nfsserver.py
bceef4
+++ /dev/null
bceef4
@@ -1,55 +0,0 @@
bceef4
-# Copyright (C) 2007 Red Hat, Inc., Eugene Teo <eteo@redhat.com>
bceef4
-
bceef4
-# This file is part of the sos project: https://github.com/sosreport/sos
bceef4
-#
bceef4
-# This copyrighted material is made available to anyone wishing to use,
bceef4
-# modify, copy, or redistribute it subject to the terms and conditions of
bceef4
-# version 2 of the GNU General Public License.
bceef4
-#
bceef4
-# See the LICENSE file in the source distribution for further information.
bceef4
-
bceef4
-from sos.plugins import Plugin, RedHatPlugin
bceef4
-import os
bceef4
-from stat import ST_SIZE
bceef4
-
bceef4
-
bceef4
-class NfsServer(Plugin, RedHatPlugin):
bceef4
-    """NFS server information
bceef4
-    """
bceef4
-
bceef4
-    plugin_name = 'nfsserver'
bceef4
-    profiles = ('storage', 'network', 'services', 'nfs')
bceef4
-
bceef4
-    def check_enabled(self):
bceef4
-        default_runlevel = self.policy.default_runlevel()
bceef4
-        nfs_runlevels = self.policy.runlevel_by_service("nfs")
bceef4
-        if default_runlevel in nfs_runlevels:
bceef4
-            return True
bceef4
-
bceef4
-        try:
bceef4
-            exports = os.stat("/etc/exports")[ST_SIZE]
bceef4
-            xtab = os.stat("/var/lib/nfs/xtab")[ST_SIZE]
bceef4
-            if exports or xtab:
bceef4
-                return True
bceef4
-        except OSError:
bceef4
-            pass
bceef4
-
bceef4
-        return False
bceef4
-
bceef4
-    def setup(self):
bceef4
-        self.add_copy_spec([
bceef4
-            "/etc/exports",
bceef4
-            "/etc/exports.d",
bceef4
-            "/var/lib/nfs/etab",
bceef4
-            "/var/lib/nfs/xtab",
bceef4
-            "/var/lib/nfs/rmtab"
bceef4
-        ])
bceef4
-
bceef4
-        self.add_cmd_output([
bceef4
-            "rpcinfo -p localhost",
bceef4
-            "nfsstat -o all",
bceef4
-            "exportfs -v"
bceef4
-        ])
bceef4
-
bceef4
-
bceef4
-# vim: set et ts=4 sw=4 :
bceef4
-- 
bceef4
2.26.2
bceef4