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