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

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