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

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