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