Blame SOURCES/0001-Support-python3-dictionary-access.patch

e0c1d8
From 531d63d4e6acf6f4959e20f61f300921f764690c Mon Sep 17 00:00:00 2001
e0c1d8
From: Lee Duncan <lduncan@suse.com>
e0c1d8
Date: Fri, 13 Apr 2018 11:56:29 -0700
e0c1d8
Subject: [PATCH] Support python3 dictionary access.
e0c1d8
e0c1d8
Support python2 and python3 dictionary access by using the iteritems
e0c1d8
function the 'python-six' module.
e0c1d8
e0c1d8
Also, add info to the README about supporting both Python2 and Python3.
e0c1d8
e0c1d8
Signed-off-by: Lee Duncan <lduncan@suse.com>
e0c1d8
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
e0c1d8
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
e0c1d8
Signed-off-by: Christoph Hellwig <hch@lst.de>
e0c1d8
---
e0c1d8
 README        | 8 +++++---
e0c1d8
 nvmet/nvme.py | 3 ++-
e0c1d8
 2 files changed, 7 insertions(+), 4 deletions(-)
e0c1d8
e0c1d8
diff --git a/README b/README
e0c1d8
index cd4bd78..c8717e8 100644
e0c1d8
--- a/README
e0c1d8
+++ b/README
e0c1d8
@@ -14,9 +14,11 @@ using setup.py.
e0c1d8
 
e0c1d8
 Common Package Dependencies and Problems
e0c1d8
 -----------------------------------------
e0c1d8
-nvmetcli uses the 'python-six' and 'pyparsing' packages
e0c1d8
-(running nvmetcli without these packages may produce
e0c1d8
-hard-to-decipher errors).
e0c1d8
+Both python2 and python3 are supported via use of the 'python-six'
e0c1d8
+package.
e0c1d8
+
e0c1d8
+nvmetcli uses the 'pyparsing' package -- running nvmetcli without this
e0c1d8
+package may produce hard-to-decipher errors.
e0c1d8
 
e0c1d8
 Usage
e0c1d8
 -----
e0c1d8
diff --git a/nvmet/nvme.py b/nvmet/nvme.py
e0c1d8
index f5d0555..89bf9cd 100644
e0c1d8
--- a/nvmet/nvme.py
e0c1d8
+++ b/nvmet/nvme.py
e0c1d8
@@ -23,6 +23,7 @@ import stat
e0c1d8
 import uuid
e0c1d8
 import json
e0c1d8
 from glob import iglob as glob
e0c1d8
+from six import iteritems
e0c1d8
 
e0c1d8
 DEFAULT_SAVE_FILE = '/etc/nvmet/config.json'
e0c1d8
 
e0c1d8
@@ -219,7 +220,7 @@ class CFSNode(object):
e0c1d8
 
e0c1d8
     def _setup_attrs(self, attr_dict, err_func):
e0c1d8
         for group in self.attr_groups:
e0c1d8
-            for name, value in attr_dict.get(group, {}).iteritems():
e0c1d8
+            for name, value in iteritems(attr_dict.get(group, {})):
e0c1d8
                 try:
e0c1d8
                     self.set_attr(group, name, value)
e0c1d8
                 except CFSError as e:
e0c1d8
-- 
e0c1d8
1.8.3.1
e0c1d8