[PATCH pynfs 2/2] 4.1 server: Compare with int variable instead of string

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Similarly to previous commit prefer using int variables
(e.g. NFS4_OK) than string literals (e.g. "NFS4_OK"),
which don't detect typos.

This requires to change status parameter of show_op()
from string to int.

Signed-off-by: Petr Vorel <pvorel@xxxxxxx>
---
 nfs4.1/nfs4server.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/nfs4.1/nfs4server.py b/nfs4.1/nfs4server.py
index 6f7d10c..9422481 100755
--- a/nfs4.1/nfs4server.py
+++ b/nfs4.1/nfs4server.py
@@ -515,8 +515,8 @@ class SummaryOutput:
 
         summary_line = "  %s" % ', '.join(opnames)
 
-        if status != "NFS4_OK" and status != "NFS3_OK":
-            summary_line += " -> %s" % (status,)
+        if status != NFS4_OK and status != NFS3_OK:
+            summary_line += " -> %s" % nfsstat4[status]
 
         print_summary_line = True
         if summary_line != self._last or role != self._last_role:
@@ -850,7 +850,7 @@ class NFS4Server(rpc.Server):
         log_41.info("Replying.  Status %s (%d)" % (nfsstat4[status], status))
         client_addr = '%s:%s' % cred.connection._s.getpeername()[:2]
         self.summary.show_op('handle v4.1 %s' % client_addr,
-                             opnames, nfsstat4[status])
+                             opnames, status)
         return env
 
     def delete_session(self, session, sessionid):
-- 
2.31.1




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux