]> www.infradead.org Git - users/hch/nvmetcli.git/commitdiff
Support python3 dictionary access.
authorLee Duncan <lduncan@suse.com>
Fri, 13 Apr 2018 18:56:29 +0000 (11:56 -0700)
committerChristoph Hellwig <hch@lst.de>
Tue, 17 Apr 2018 15:11:40 +0000 (17:11 +0200)
Support python2 and python3 dictionary access by using the iteritems
function the 'python-six' module.

Also, add info to the README about supporting both Python2 and Python3.

Signed-off-by: Lee Duncan <lduncan@suse.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
README
nvmet/nvme.py

diff --git a/README b/README
index cd4bd7838637895bb327767c9581492015840130..c8717e8b8b33f58f286b009d99007ce97b14fd4a 100644 (file)
--- a/README
+++ b/README
@@ -14,9 +14,11 @@ using setup.py.
 
 Common Package Dependencies and Problems
 -----------------------------------------
-nvmetcli uses the 'python-six' and 'pyparsing' packages
-(running nvmetcli without these packages may produce
-hard-to-decipher errors).
+Both python2 and python3 are supported via use of the 'python-six'
+package.
+
+nvmetcli uses the 'pyparsing' package -- running nvmetcli without this
+package may produce hard-to-decipher errors.
 
 Usage
 -----
index f5d0555d2acdbde96b63ed476db8616b10279e14..89bf9cd956a89b661ac1cbe3682653f6e83a94a2 100644 (file)
@@ -23,6 +23,7 @@ import stat
 import uuid
 import json
 from glob import iglob as glob
+from six import iteritems
 
 DEFAULT_SAVE_FILE = '/etc/nvmet/config.json'
 
@@ -219,7 +220,7 @@ class CFSNode(object):
 
     def _setup_attrs(self, attr_dict, err_func):
         for group in self.attr_groups:
-            for name, value in attr_dict.get(group, {}).iteritems():
+            for name, value in iteritems(attr_dict.get(group, {})):
                 try:
                     self.set_attr(group, name, value)
                 except CFSError as e: