summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Grover <agrover@redhat.com>2013-05-09 09:57:44 -0700
committerAndy Grover <agrover@redhat.com>2013-05-09 09:57:44 -0700
commitee9e2a4628d5ee7a7fdffb3b378233c0296fdb37 (patch)
treebed2dafefa2aa9533b06e954aac5b0661f5dfbfe
parenta801dcb0dd572c4f38a56a66c3ad46e9553ca9e6 (diff)
downloadrtslib-fb-ee9e2a4628d5ee7a7fdffb3b378233c0296fdb37.tar.gz
Fix issues found by pychecker
Signed-off-by: Andy Grover <agrover@redhat.com>
-rw-r--r--rtslib/__init__.py2
-rw-r--r--rtslib/fabric.py2
-rw-r--r--rtslib/root.py1
-rw-r--r--rtslib/target.py3
-rw-r--r--rtslib/tcm.py2
-rw-r--r--rtslib/utils.py3
6 files changed, 4 insertions, 9 deletions
diff --git a/rtslib/__init__.py b/rtslib/__init__.py
index 0eee220..146dc1f 100644
--- a/rtslib/__init__.py
+++ b/rtslib/__init__.py
@@ -15,8 +15,6 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
'''
-import utils
-
from root import RTSRoot
from utils import RTSLibError, RTSLibBrokenLink, RTSLibNotInCFS
diff --git a/rtslib/fabric.py b/rtslib/fabric.py
index 5ef0ed6..b5e507c 100644
--- a/rtslib/fabric.py
+++ b/rtslib/fabric.py
@@ -162,7 +162,7 @@ class _BaseFabricModule(CFSNode):
def _get_version(self):
if self.exists:
- for attr in self.version_attributes:
+ for attr in version_attributes:
path = "%s/%s" % (self.path, attr)
if os.path.isfile(path):
return fread(path)
diff --git a/rtslib/root.py b/rtslib/root.py
index e25cef6..93ef585 100644
--- a/rtslib/root.py
+++ b/rtslib/root.py
@@ -71,7 +71,6 @@ class RTSRoot(CFSNode):
def _list_targets(self):
self._check_self()
- targets = set([])
for fabric_module in self.fabric_modules:
for target in fabric_module.targets:
yield target
diff --git a/rtslib/target.py b/rtslib/target.py
index 0da4ee7..04125ac 100644
--- a/rtslib/target.py
+++ b/rtslib/target.py
@@ -22,7 +22,6 @@ import re
import os
from glob import iglob as glob
import uuid
-import shutil
from node import CFSNode
from os.path import isdir
@@ -362,7 +361,7 @@ class TPG(CFSNode):
# Not using fabric-specific version of normalize_wwn, since we
# want to make sure wwn conforms to regexp, but don't check
# against target wwn_list, since we're setting the "initiator" here.
- nexus_wwn = normalize_wwn((wwn_type,), wwn)[0]
+ nexus_wwn = normalize_wwn((wwn_type,), nexus_wwn)[0]
else:
nexus_wwn = generate_wwn(wwn_type)
diff --git a/rtslib/tcm.py b/rtslib/tcm.py
index 17742d6..e537bc4 100644
--- a/rtslib/tcm.py
+++ b/rtslib/tcm.py
@@ -736,7 +736,7 @@ class _Backstore(CFSNode):
bs_cache[self._lookup_key] = self._index
break
else:
- raise ExecutionError("No available backstore index")
+ raise RTSLibError("No available backstore index")
self._path = "%s/core/%s_%d" % (self.configfs_dir,
dirp,
diff --git a/rtslib/utils.py b/rtslib/utils.py
index 6b40211..baee30a 100644
--- a/rtslib/utils.py
+++ b/rtslib/utils.py
@@ -21,7 +21,6 @@ import re
import os
import stat
import uuid
-import glob
import socket
import subprocess
from contextlib import contextmanager
@@ -151,7 +150,7 @@ def get_block_type(path):
# is dev a block device?
try:
- maj_min = "%s:%s" % get_block_numbers(dev)
+ get_block_numbers(dev)
except (OSError, IOError):
return None